在Google Contacts API v3中为联系人指定自定义字段 [英] Specifying custom fields for contacts in Google Contacts API v3

查看:67
本文介绍了在Google Contacts API v3中为联系人指定自定义字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在创建/更新与API的联系时(同时也检索它)如何指定自定义字段?我正在使用Python API.

How do I specify custom fields while creating/updating a contact with the API (also retrieving it)? I'm using the Python API.

推荐答案

import gdata.contacts.data

new_contact = gdata.contacts.data.ContactEntry()

# Set the contact's name.
new_contact.name = gdata.data.Name(
    given_name=gdata.data.GivenName(text='Elizabeth'),
    family_name=gdata.data.FamilyName(text='Bennet'),
    full_name=gdata.data.FullName(text='Elizabeth Bennet')
)

# Set user defined fields
new_contact.user_defined_field.append(
    gdata.contacts.data.UserDefinedField(
        key='Field Name',
        value='Field Value'
    )
)

这篇关于在Google Contacts API v3中为联系人指定自定义字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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