Skip to content Skip to sidebar Skip to footer

Specifying Custom Fields For Contacts In Google Contacts Api V3

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

Solution 1:

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'
    )
)

Post a Comment for "Specifying Custom Fields For Contacts In Google Contacts Api V3"