This service allows scripts to access and modify Google Contacts, both for individual contacts and for groups.
Classes
Name | Brief description |
---|---|
AddressField | Address field in a contact. |
CompanyField | Company field in a Contact. |
Contact | A Contact contains the name, address, and various contact details of a contact. |
ContactGroup | A ContactGroup is is a group of contacts. |
ContactsApp | This class allows users to access their own Google Contacts and create, remove, and update contacts listed therein. |
CustomField | A custom field in a Contact. |
DateField | A date field in a Contact. |
EmailField | An email field in a Contact. |
ExtendedField | An enum for extended contacts fields. |
Field | An enum for contacts fields. |
Gender | An enum for contact gender. |
IMField | An instant messaging field in a Contact. |
PhoneField | A phone number field in a Contact. |
Priority | An enum for contact priority. |
Sensitivity | An enum for contact sensitivity. |
UrlField | A URL field in a Contact. |
AddressField
Methods
Method | Return type | Brief description |
---|---|---|
deleteAddressField() | void | Deletes this address field. |
getAddress() | String | Get the address for this field. |
getLabel() | Object | Gets the label for this field. |
isPrimary() | Boolean | Gets whether this is the primary field value. |
setAddress(address) | AddressField | Sets the address of this field. |
setAsPrimary() | AddressField | Sets this field to primary. |
setLabel(field) | AddressField | Sets the label of this field. |
setLabel(label) | AddressField | Sets the label of this field. |
CompanyField
Methods
Method | Return type | Brief description |
---|---|---|
deleteCompanyField() | void | Deletes this company field. |
getCompanyName() | String | Gets the company name. |
getJobTitle() | String | Gets the job title. |
isPrimary() | Boolean | Gets whether this is the primary company. |
setAsPrimary() | CompanyField | Sets this company as the primary company, and unsets whatever company was previously primary. |
setCompanyName(company) | CompanyField | Sets the company name. |
setJobTitle(title) | CompanyField | Sets the job title. |
Contact
Methods
Method | Return type | Brief description |
---|---|---|
addAddress(label, address) | AddressField | Adds an address to the contact with either a standard or custom label. |
addCompany(company, title) | CompanyField | Adds a company to the contact. |
addCustomField(label, content) | CustomField | Adds a custom field to the contact with either an extended or custom label. |
addDate(label, month, day, year) | DateField | Adds a date to the contact with either an standard or custom label. |
addEmail(label, address) | EmailField | Add an email address with a standard label (home, work, etc.) or a custom label |
addIM(label, address) | IMField | Adds an IM address to the contact with either a standard or custom label. |
addPhone(label, number) | PhoneField | Adds a phone number to the contact with either a standard or custom label. |
addToGroup(group) | Contact | Adds this contact to the given contact group. |
addUrl(label, url) | UrlField | Adds a URL to the contact with either a standard or custom label. |
deleteContact() | void | Deletes 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() | String | Gets the family name (last name) of the contact as a string. |
getFullName() | String | Gets the full name (given name and last name) of the contact as a string. |
getGivenName() | String | Gets 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() | String | Returns the unique id of this contact. |
getInitials() | String | Gets the contact's initials. |
getLastUpdated() | Date | Gets the date this contact was last updated. |
getMaidenName() | String | Gets the maiden name of the contact as a string. |
getMiddleName() | String | Gets the middle name of the contact as a string. |
getNickname() | String | Gets the nickname of the contact as a string. |
getNotes() | String | Gets 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() | String | Gets the prefix to the contact's name. |
getPrimaryEmail() | String | Gets the primary email address of the contact as a string. |
getShortName() | String | Gets the short name of the contact as a string. |
getSuffix() | String | Gets 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) | Contact | Removes this contact from the given contact group. |
setFamilyName(familyName) | Contact | Sets the family name (last name) of the contact. |
setFullName(fullName) | Contact | Sets the full name (given name and last name) of the contact. |
setGivenName(givenName) | Contact | Sets the given name (first name) of the contact. |
setInitials(initials) | Contact | Sets the contact's initials. |
setMaidenName(maidenName) | Contact | Sets the maiden name of the contact. |
setMiddleName(middleName) | Contact | Sets the middle name of the contact. |
setNickname(nickname) | Contact | Sets the nickname of the contact. |
setNotes(notes) | Contact | Sets the notes associated with this contact. |
setPrefix(prefix) | Contact | Sets the prefix to the contact's name. |
setShortName(shortName) | Contact | Sets the short name of the contact. |
setSuffix(suffix) | Contact | Sets the suffix to the contact's name. |
ContactGroup
Methods
Method | Return type | Brief description |
---|---|---|
addContact(contact) | ContactGroup | Adds the given contact to this group |
deleteGroup() | void | Deletes this contact group. |
getContacts() | Contact[] | Gets all the contacts in this contact group. |
getId() | String | Gets the id of this contact group. |
getName() | String | Gets the name of this contact group. |
isSystemGroup() | Boolean | Gets a boolean value to determine whether this contact group is a system group (undeletable) or not. |
removeContact(contact) | ContactGroup | Removes the given contact from this group |
setName(name) | ContactGroup | Sets the name of this contact group. |
ContactsApp
Properties
Property | Type | Description |
---|---|---|
ExtendedField | ExtendedField | |
Field | Field | |
Gender | Gender | |
Month | Month | |
Priority | Priority | |
Sensitivity | Sensitivity |
Methods
Method | Return type | Brief description |
---|---|---|
createContact(givenName, familyName, email) | Contact | Creates a new contact. |
createContactGroup(name) | ContactGroup | Creates a contact group with the given name |
deleteContact(contact) | void | Deletes the contact. |
deleteContactGroup(group) | void | Deletes the contact group |
getContact(emailAddress) | Contact | Gets a contact by the email address. |
getContactById(id) | Contact | Gets the contact with this id. |
getContactGroup(name) | ContactGroup | Gets a contact group with the given name, or returns null if no such contact group is found. |
getContactGroupById(id) | ContactGroup | Gets 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. |
CustomField
Methods
Method | Return type | Brief description |
---|---|---|
deleteCustomField() | void | Deletes this field. |
getLabel() | Object | Gets the label for this field. |
getValue() | Object | Gets the value of the field. |
setLabel(field) | CustomField | Sets the label of this field. |
setLabel(label) | CustomField | Sets the label of this field. |
setValue(value) | CustomField | Sets the value of this field. |
DateField
Methods
Method | Return type | Brief description |
---|---|---|
deleteDateField() | void | Deletes this date. |
getDay() | Integer | Gets the day of the month for this date. |
getLabel() | Object | Gets the label for this field. |
getMonth() | Month | Gets the month for this date. |
getYear() | Integer | Gets the year for this date. |
setDate(month, day) | DateField | Sets the date to this day, without a year. |
setDate(month, day, year) | DateField | Sets the date to this day. |
setLabel(label) | DateField | Sets the label of this field, such as 'Birthday' or 'Anniversary'. |
setLabel(label) | DateField | Sets the label of this field. |
EmailField
Methods
Method | Return type | Brief description |
---|---|---|
deleteEmailField() | void | Deletes this email address from the Contact. |
getAddress() | String | Get the address for this field. |
getDisplayName() | String | Returns the display name for this email address. |
getLabel() | Object | Gets the label for this field. |
isPrimary() | Boolean | Gets whether this is the primary field value. |
setAddress(address) | EmailField | Sets the address of this field. |
setAsPrimary() | EmailField | Sets this field to primary. |
setDisplayName(name) | EmailField | Sets the display name for this email address. |
setLabel(field) | EmailField | Sets the label of this field. |
setLabel(label) | EmailField | Sets the label of this field. |
ExtendedField
Properties
Property | Type | Description |
---|---|---|
HOBBY | Enum | the contact's hobby |
MILEAGE | Enum | the contact's mileage |
LANGUAGE | Enum | the contact's language |
GENDER | Enum | the contact's gender |
BILLING_INFORMATION | Enum | the contact's billing information |
DIRECTORY_SERVER | Enum | the contact's directory server |
SENSITIVITY | Enum | the contact's sensitivity |
PRIORITY | Enum | the contact's priority |
HOME | Enum | the contact's home information |
WORK | Enum | the contact's work information |
USER | Enum | the contact's user information |
OTHER | Enum | the contact's other information |
Field
Properties
Property | Type | Description |
---|---|---|
FULL_NAME | Enum | the contact's full name |
GIVEN_NAME | Enum | the contact's given (first) name |
MIDDLE_NAME | Enum | the contact's middle name |
FAMILY_NAME | Enum | the contact's family (last) name |
MAIDEN_NAME | Enum | the contact's maiden name |
NICKNAME | Enum | the contact's nickname |
SHORT_NAME | Enum | the contact's short name |
INITIALS | Enum | the contact's initials |
PREFIX | Enum | the prefix for the contact's name |
SUFFIX | Enum | the suffix for the contact's name |
HOME_EMAIL | Enum | the contact's home email address |
WORK_EMAIL | Enum | the contact's work email address |
BIRTHDAY | Enum | the contact's birthday |
ANNIVERSARY | Enum | the contact's anniversary |
HOME_ADDRESS | Enum | the contact's home address |
WORK_ADDRESS | Enum | the contact's work address |
ASSISTANT_PHONE | Enum | the contact's assistant's phone number |
CALLBACK_PHONE | Enum | the contact's callback phone number |
MAIN_PHONE | Enum | the contact's main phone number |
PAGER | Enum | the contact's pager number |
HOME_FAX | Enum | the contact's home fax number |
WORK_FAX | Enum | the contact's work fax number |
HOME_PHONE | Enum | the contact's home phone number |
WORK_PHONE | Enum | the contact's work phone number |
MOBILE_PHONE | Enum | the contact's mobile phone number |
GOOGLE_VOICE | Enum | the contact's Google Voice number |
NOTES | Enum | notes about the contact |
GOOGLE_TALK | Enum | the contact's Google Talk identifier |
AIM | Enum | the contact's AIM identifier |
YAHOO | Enum | the contact's Yahoo instant messaging identifier |
SKYPE | Enum | the contact's Skype identifier |
QQ | Enum | the contact's QQ identifer |
MSN | Enum | the contact's MSN identifier |
ICQ | Enum | the contact's ICQ identifier |
JABBER | Enum | the contact's Jabber identifier |
BLOG | Enum | the contact's blog URL |
FTP | Enum | the contact's FTP URL |
PROFILE | Enum | the contact's profile URL |
HOME_PAGE | Enum | the contact's home page URL |
WORK_WEBSITE | Enum | the contact's work website URL |
HOME_WEBSITE | Enum | the contact's home website URL |
JOB_TITLE | Enum | the contact's job title |
COMPANY | Enum | the contact's company |
Gender
Properties
Property | Type | Description |
---|---|---|
MALE | Enum | male gender |
FEMALE | Enum | female gender |
IMField
Methods
Method | Return type | Brief description |
---|---|---|
deleteIMField() | void | Deletes this instant messaging field. |
getAddress() | String | Get the address for this field. |
getLabel() | Object | Gets the label for this field. |
isPrimary() | Boolean | Gets whether this is the primary field value. |
setAddress(address) | IMField | Sets the address of this field. |
setAsPrimary() | IMField | Sets this field to primary. |
setLabel(field) | IMField | Sets the label of this field. |
setLabel(label) | IMField | Sets the label of this field. |
PhoneField
Methods
Method | Return type | Brief description |
---|---|---|
deletePhoneField() | void | Deletes this phone number field. |
getLabel() | Object | Gets the label for this field. |
getPhoneNumber() | String | Get the phone number for this field. |
isPrimary() | Boolean | Gets whether this is the primary field value. |
setAsPrimary() | PhoneField | Sets this field to primary. |
setLabel(field) | PhoneField | Sets the label of this field. |
setLabel(label) | PhoneField | Sets the label of this field. |
setPhoneNumber(number) | PhoneField | Sets the phone number for this field. |
Priority
Properties
Property | Type | Description |
---|---|---|
HIGH | Enum | high priority |
LOW | Enum | low priority |
NORMAL | Enum | normal priority |
Sensitivity
Properties
Property | Type | Description |
---|---|---|
CONFIDENTIAL | Enum | confidential sensitivity |
NORMAL | Enum | normal sensitivity |
PERSONAL | Enum | personal sensitivity |
PRIVATE | Enum | private sensitivity |
UrlField
Methods
Method | Return type | Brief description |
---|---|---|
deleteUrlField() | void | Deletes this URL field. |
getAddress() | String | Get the address for this field. |
getLabel() | Object | Gets the label for this field. |
isPrimary() | Boolean | Gets whether this is the primary field value. |
setAddress(address) | UrlField | Sets the address of this field. |
setAsPrimary() | UrlField | Sets this field to primary. |
setLabel(field) | UrlField | Sets the label of this field. |
setLabel(label) | UrlField | Sets the label of this field. |