AaronF
AaronF

Reputation: 41

Add Organization info to Google Contacts API

I have the contact API working with Google, so for example:

contact = gdata.contacts.data.ContactEntry()
contact.name = gdata.data.Name(given_name=gdata.data.GivenName(text='Frank'),
family_name=gdata.data.FamilyName(text='Something'))

However I need to add organization and title to the contact, and the documentation is pretty sparse; I tried this with no success:

contact.organization=gdata.data.Organization(name='My Company',title='Chief Fun Officer')

That command works, however when I execute:

client.CreateContact(contact,feed)

It fails with:

AttributeError: 'str' object has no attribute '_become_child'

Any ideas?

Upvotes: 1

Views: 385

Answers (1)

Geo Jacob
Geo Jacob

Reputation: 6009

This is the correct way of adding organization details:

contact.organization= gdata.data.Organization(name=gdata.data.OrgName(text='My Company'), title=gdata.data.OrgTitle(text='Chief Fun Officer'), rel=gdata.data.WORK_REL)

Upvotes: 2

Related Questions