Add Organization info to Google Contacts API

江枫思渺然 提交于 2019-12-11 10:44:27

问题


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?


回答1:


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)


来源:https://stackoverflow.com/questions/30624569/add-organization-info-to-google-contacts-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!