Contacts Service

This service allows scripts to access and modify Google Contacts, both for individual contacts and for groups.

Classes

NameBrief description
AddressFieldAddress field in a contact.
CompanyFieldCompany field in a Contact.
ContactA Contact contains the name, address, and various contact details of a contact.
ContactGroupA ContactGroup is is a group of contacts.
ContactsAppThis class allows users to access their own Google Contacts and create, remove, and update contacts listed therein.
CustomFieldA custom field in a Contact.
DateFieldA date field in a Contact.
EmailFieldAn email field in a Contact.
ExtendedFieldAn enum for extended contacts fields.
FieldAn enum for contacts fields.
GenderAn enum for contact gender.
IMFieldAn instant messaging field in a Contact.
PhoneFieldA phone number field in a Contact.
PriorityAn enum for contact priority.
SensitivityAn enum for contact sensitivity.
UrlFieldA URL field in a Contact.

Class AddressField

Methods

MethodReturn typeBrief description
deleteAddressField()voidDeletes this address field.
getAddress()StringGet the address for this field.
getLabel()ObjectGets the label for this field.
isPrimary()BooleanGets whether this is the primary field value.
setAddress(address)AddressFieldSets the address of this field.
setAsPrimary()AddressFieldSets this field to primary.
setLabel(field)AddressFieldSets the label of this field.
setLabel(label)AddressFieldSets the label of this field.

Class CompanyField

Methods

MethodReturn typeBrief description
deleteCompanyField()voidDeletes this company field.
getCompanyName()StringGets the company name.
getJobTitle()StringGets the job title.
isPrimary()BooleanGets whether this is the primary company.
setAsPrimary()CompanyFieldSets this company as the primary company, and unsets whatever company was previously primary.
setCompanyName(company)CompanyFieldSets the company name.
setJobTitle(title)CompanyFieldSets the job title.

Class Contact

Methods

MethodReturn typeBrief description
addAddress(label, address)AddressFieldAdds an address to the contact with either a standard or custom label.
addCompany(company, title)CompanyFieldAdds a company to the contact.
addCustomField(label, content)CustomFieldAdds a custom field to the contact with either an extended or custom label.
addDate(label, month, day, year)DateFieldAdds a date to the contact with either an standard or custom label.
addEmail(label, address)EmailFieldAdd an email address with a standard label (home, work, etc.) or a custom label
addIM(label, address)IMFieldAdds an IM address to the contact with either a standard or custom label.
addPhone(label, number)PhoneFieldAdds a phone number to the contact with either a standard or custom label.
addToGroup(group)ContactAdds this contact to the given contact group.
addUrl(label, url)UrlFieldAdds a URL to the contact with either a standard or custom label.
deleteContact()voidDeletes this contact.
getAddresses()AddressField[]Gets all the addresses for this contact.
getAddresses(label)AddressField[]Gets all the addresses for this contact matching a particular field.
getCompanies()CompanyField[]Gets all the companies for this contact.
getContactGroups()ContactGroup[]Gets all the contact groups that contain this contact.
getCustomFields()CustomField[]Gets all the custom fields for this contact.
getCustomFields(label)CustomField[]Gets all the custom fields for this contact matching a particular field.
getDates()DateField[]Gets all the dates for this contact.
getDates(label)DateField[]Gets all the dates for this contact matching a particular field.
getEmails()EmailField[]Gets the email addresses of this contact.
getEmails(label)EmailField[]Gets the email addresses for this contact matching a particular field.
getFamilyName()StringGets the family name (last name) of the contact as a string.
getFullName()StringGets the full name (given name and last name) of the contact as a string.
getGivenName()StringGets the given name (first name) of the contact as a string.
getIMs()IMField[]Gets all the IM addresses for this contact.
getIMs(label)IMField[]Gets all the IM addresses for this contact matching a particular field.
getId()StringReturns the unique id of this contact.
getInitials()StringGets the contact's initials.
getLastUpdated()DateGets the date this contact was last updated.
getMaidenName()StringGets the maiden name of the contact as a string.
getMiddleName()StringGets the middle name of the contact as a string.
getNickname()StringGets the nickname of the contact as a string.
getNotes()StringGets the notes associated with this contact, or an empty string if there are no notes.
getPhones()PhoneField[]Gets all the phone numbers for this contact.
getPhones(label)PhoneField[]Gets all the phone numbers for this contact matching a particular field.
getPrefix()StringGets the prefix to the contact's name.
getPrimaryEmail()StringGets the primary email address of the contact as a string.
getShortName()StringGets the short name of the contact as a string.
getSuffix()StringGets the suffix to the contact's name.
getUrls()UrlField[]Gets all the URLs for this contact.
getUrls(label)UrlField[]Gets all the URLs for this contact matching a particular field.
removeFromGroup(group)ContactRemoves this contact from the given contact group.
setFamilyName(familyName)ContactSets the family name (last name) of the contact.
setFullName(fullName)ContactSets the full name (given name and last name) of the contact.
setGivenName(givenName)ContactSets the given name (first name) of the contact.
setInitials(initials)ContactSets the contact's initials.
setMaidenName(maidenName)ContactSets the maiden name of the contact.
setMiddleName(middleName)ContactSets the middle name of the contact.
setNickname(nickname)ContactSets the nickname of the contact.
setNotes(notes)ContactSets the notes associated with this contact.
setPrefix(prefix)ContactSets the prefix to the contact's name.
setShortName(shortName)ContactSets the short name of the contact.
setSuffix(suffix)ContactSets the suffix to the contact's name.

Class ContactGroup

Methods

MethodReturn typeBrief description
addContact(contact)ContactGroupAdds the given contact to this group
deleteGroup()voidDeletes this contact group.
getContacts()Contact[]Gets all the contacts in this contact group.
getId()StringGets the id of this contact group.
getName()StringGets the name of this contact group.
isSystemGroup()BooleanGets a boolean value to determine whether this contact group is a system group (undeletable) or not.
removeContact(contact)ContactGroupRemoves the given contact from this group
setName(name)ContactGroupSets the name of this contact group.

Class ContactsApp

Properties

PropertyTypeDescription
ExtendedFieldExtendedField
FieldField
GenderGender
MonthMonth
PriorityPriority
SensitivitySensitivity

Methods

MethodReturn typeBrief description
createContact(givenName, familyName, email)ContactCreates a new contact.
createContactGroup(name)ContactGroupCreates a contact group with the given name
deleteContact(contact)voidDeletes the contact.
deleteContactGroup(group)voidDeletes the contact group
getContact(emailAddress)ContactGets a contact by the email address.
getContactById(id)ContactGets the contact with this id.
getContactGroup(name)ContactGroupGets a contact group with the given name, or returns null if no such contact group is found.
getContactGroupById(id)ContactGroupGets a contact group with the given id, or returns null if no such contact group is found.
getContactGroups()ContactGroup[]Gets the complete list of the user's contact groups.
getContacts()Contact[]Gets all of the user's contacts.
getContactsByAddress(query)Contact[]Get contacts matching an address.
getContactsByAddress(query, label)Contact[]Get contacts matching an address, limited to a specific field.
getContactsByAddress(query, label)Contact[]Get contacts matching an address, limited to the specified custom address label.
getContactsByCompany(query)Contact[]Get contacts matching the company field.
getContactsByCustomField(query, label)Contact[]Get contacts matching a given value in a custom field.
getContactsByDate(month, day, label)Contact[]Get contacts matching a given month and day for a particular standard field.
getContactsByDate(month, day, year, label)Contact[]Get contacts matching a given month, day, and year for a particular standard field.
getContactsByDate(month, day, year, label)Contact[]Get contacts matching a given month, day, and year for a particular custom field.
getContactsByDate(month, day, label)Contact[]Get contacts matching a given month and day for a particular custom field.
getContactsByEmailAddress(query)Contact[]Get contacts matching an email address.
getContactsByEmailAddress(query, label)Contact[]Get contacts matching an email address, limited to a specific field.
getContactsByEmailAddress(query, label)Contact[]Get contacts matching an email address, limited to the specified custom email address label.
getContactsByGroup(group)Contact[]Get the contacts in a given ContactGroup.
getContactsByIM(query)Contact[]Get contacts matching an instant messaging address.
getContactsByIM(query, label)Contact[]Get contacts matching an instant messaging address, limited to a specific field.
getContactsByIM(query, label)Contact[]Get contacts matching an instant messaging address, limited to the specified custom instant messaging label.
getContactsByJobTitle(query)Contact[]Get contacts matching the job title field.
getContactsByName(query)Contact[]Get contacts matching a name.
getContactsByName(query, label)Contact[]Get contacts matching a name, limited to a specific field.
getContactsByNotes(query)Contact[]Get contacts matching the notes field.
getContactsByPhone(query)Contact[]Get contacts matching a phone number.
getContactsByPhone(query, label)Contact[]Get contacts matching a phone number, limited to a specific field.
getContactsByPhone(query, label)Contact[]Get contacts matching a phone number, limited to the specified custom phone number label.
getContactsByUrl(query)Contact[]Get contacts matching a URL.
getContactsByUrl(query, label)Contact[]Get contacts matching a URL, limited to a specific field.
getContactsByUrl(query, label)Contact[]Get contacts matching a URL, limited to the specified custom URL label.

Class CustomField

Methods

MethodReturn typeBrief description
deleteCustomField()voidDeletes this field.
getLabel()ObjectGets the label for this field.
getValue()ObjectGets the value of the field.
setLabel(field)CustomFieldSets the label of this field.
setLabel(label)CustomFieldSets the label of this field.
setValue(value)CustomFieldSets the value of this field.

Class DateField

Methods

MethodReturn typeBrief description
deleteDateField()voidDeletes this date.
getDay()IntegerGets the day of the month for this date.
getLabel()ObjectGets the label for this field.
getMonth()MonthGets the month for this date.
getYear()IntegerGets the year for this date.
setDate(month, day)DateFieldSets the date to this day, without a year.
setDate(month, day, year)DateFieldSets the date to this day.
setLabel(label)DateFieldSets the label of this field, such as 'Birthday' or 'Anniversary'.
setLabel(label)DateFieldSets the label of this field.

Class EmailField

Methods

MethodReturn typeBrief description
deleteEmailField()voidDeletes this email address from the Contact.
getAddress()StringGet the address for this field.
getDisplayName()StringReturns the display name for this email address.
getLabel()ObjectGets the label for this field.
isPrimary()BooleanGets whether this is the primary field value.
setAddress(address)EmailFieldSets the address of this field.
setAsPrimary()EmailFieldSets this field to primary.
setDisplayName(name)EmailFieldSets the display name for this email address.
setLabel(field)EmailFieldSets the label of this field.
setLabel(label)EmailFieldSets the label of this field.

Class ExtendedField

Properties

PropertyTypeDescription
HOBBYEnumthe contact's hobby
MILEAGEEnumthe contact's mileage
LANGUAGEEnumthe contact's language
GENDEREnumthe contact's gender
BILLING_INFORMATIONEnumthe contact's billing information
DIRECTORY_SERVEREnumthe contact's directory server
SENSITIVITYEnumthe contact's sensitivity
PRIORITYEnumthe contact's priority
HOMEEnumthe contact's home information
WORKEnumthe contact's work information
USEREnumthe contact's user information
OTHEREnumthe contact's other information

Class Field

Properties

PropertyTypeDescription
FULL_NAMEEnumthe contact's full name
GIVEN_NAMEEnumthe contact's given (first) name
MIDDLE_NAMEEnumthe contact's middle name
FAMILY_NAMEEnumthe contact's family (last) name
MAIDEN_NAMEEnumthe contact's maiden name
NICKNAMEEnumthe contact's nickname
SHORT_NAMEEnumthe contact's short name
INITIALSEnumthe contact's initials
PREFIXEnumthe prefix for the contact's name
SUFFIXEnumthe suffix for the contact's name
HOME_EMAILEnumthe contact's home email address
WORK_EMAILEnumthe contact's work email address
BIRTHDAYEnumthe contact's birthday
ANNIVERSARYEnumthe contact's anniversary
HOME_ADDRESSEnumthe contact's home address
WORK_ADDRESSEnumthe contact's work address
ASSISTANT_PHONEEnumthe contact's assistant's phone number
CALLBACK_PHONEEnumthe contact's callback phone number
MAIN_PHONEEnumthe contact's main phone number
PAGEREnumthe contact's pager number
HOME_FAXEnumthe contact's home fax number
WORK_FAXEnumthe contact's work fax number
HOME_PHONEEnumthe contact's home phone number
WORK_PHONEEnumthe contact's work phone number
MOBILE_PHONEEnumthe contact's mobile phone number
GOOGLE_VOICEEnumthe contact's Google Voice number
NOTESEnumnotes about the contact
GOOGLE_TALKEnumthe contact's Google Talk identifier
AIMEnumthe contact's AIM identifier
YAHOOEnumthe contact's Yahoo instant messaging identifier
SKYPEEnumthe contact's Skype identifier
QQEnumthe contact's QQ identifer
MSNEnumthe contact's MSN identifier
ICQEnumthe contact's ICQ identifier
JABBEREnumthe contact's Jabber identifier
BLOGEnumthe contact's blog URL
FTPEnumthe contact's FTP URL
PROFILEEnumthe contact's profile URL
HOME_PAGEEnumthe contact's home page URL
WORK_WEBSITEEnumthe contact's work website URL
HOME_WEBSITEEnumthe contact's home website URL
JOB_TITLEEnumthe contact's job title
COMPANYEnumthe contact's company

Class Gender

Properties

PropertyTypeDescription
MALEEnummale gender
FEMALEEnumfemale gender

Class IMField

Methods

MethodReturn typeBrief description
deleteIMField()voidDeletes this instant messaging field.
getAddress()StringGet the address for this field.
getLabel()ObjectGets the label for this field.
isPrimary()BooleanGets whether this is the primary field value.
setAddress(address)IMFieldSets the address of this field.
setAsPrimary()IMFieldSets this field to primary.
setLabel(field)IMFieldSets the label of this field.
setLabel(label)IMFieldSets the label of this field.

Class PhoneField

Methods

MethodReturn typeBrief description
deletePhoneField()voidDeletes this phone number field.
getLabel()ObjectGets the label for this field.
getPhoneNumber()StringGet the phone number for this field.
isPrimary()BooleanGets whether this is the primary field value.
setAsPrimary()PhoneFieldSets this field to primary.
setLabel(field)PhoneFieldSets the label of this field.
setLabel(label)PhoneFieldSets the label of this field.
setPhoneNumber(number)PhoneFieldSets the phone number for this field.

Class Priority

Properties

PropertyTypeDescription
HIGHEnumhigh priority
LOWEnumlow priority
NORMALEnumnormal priority

Class Sensitivity

Properties

PropertyTypeDescription
CONFIDENTIALEnumconfidential sensitivity
NORMALEnumnormal sensitivity
PERSONALEnumpersonal sensitivity
PRIVATEEnumprivate sensitivity

Class UrlField

Methods

MethodReturn typeBrief description
deleteUrlField()voidDeletes this URL field.
getAddress()StringGet the address for this field.
getLabel()ObjectGets the label for this field.
isPrimary()BooleanGets whether this is the primary field value.
setAddress(address)UrlFieldSets the address of this field.
setAsPrimary()UrlFieldSets this field to primary.
setLabel(field)UrlFieldSets the label of this field.
setLabel(label)UrlFieldSets the label of this field.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.