将组织信息添加到Google Contacts API [英] Add Organization info to Google Contacts API

查看:125
本文介绍了将组织信息添加到Google Contacts API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有与Google合作的联系人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)

它失败并显示:

AttributeError:"str"对象没有属性"_become_child"

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

有什么想法吗?

推荐答案

这是添加组织详细信息的正确方法:

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)

这篇关于将组织信息添加到Google Contacts API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆