/** Module: ContactsApp */ type ContactsApp = typeof ContactsApp; declare namespace ContactsApp { /** * Creates a new contact. * *
* // The code below creates a new contact with the name "John Doe" and the email address
* // "john.doe@example.com".
* var contact = ContactsApp.createContact('John', 'Doe', 'john.doe@example.com');
*
*
* @param givenName - the first name of the contact
* @param familyName - the last name of the contact
* @param email - the email address of the contact
*
* @returns the newly created Contact object
*/
function createContact(
givenName: string,
familyName: string,
email: string
): ContactsApp.Contact
/**
* Creates a contact group with the given name
*
*
* // The code below creates a new contact group named "Work Friends"
* var group = ContactsApp.createContactGroup("Work Friends");
*
*
* @param name - the name of the new contact group
*
* @returns the newly created contact group
*/
function createContactGroup(
name: string
): ContactsApp.ContactGroup
/**
* Deletes the contact.
*
*
* // The code below retrieves a contact with the email address "john.doe@example.com"
* // and then deletes that contact.
* var contact = ContactsApp.getContact('john.doe@example.com');
* ContactsApp.deleteContact(contact);
*
*
* @param contact - the contact to be deleted
*/
function deleteContact(
contact: ContactsApp.Contact
): void
/**
* Deletes the contact group
*
*
* // The code below creates deletes the contact group named "Work Friends"
* var group = ContactsApp.getContactGroup("Work Friends");
* ContactsApp.deleteContactGroup(group);
*
*
* @param group - the contact group to delete
*/
function deleteContactGroup(
group: ContactsApp.ContactGroup
): void
/**
* Finds a Contact with the given email address.
*
* @param email - the email address of the contact to be found
*
* @returns the Contact containing that email address
*/
function findByEmailAddress(
email: string
): ContactsApp.Contact
/**
* Finds a contact group of the given name.
*
* @param name - the name of the contact group to find
*
* @returns the contact group matching the given name
*/
function findContactGroup(
name: string
): ContactsApp.ContactGroup
/**
* Get all the contacts belonging to this user.
*
* @returns all the contacts for this user
*/
function getAllContacts(): ContactsApp.Contact[]
/**
* Gets a contact by the email address.
*
* If multiple contacts share the same email address, the method favors those contacts who have * marked the email address as primary; if none of the contacts had the email address marked as * primary or multiple contacts had the email address marked as primary, then it returns the first * result in the sorted contacts order. * *
* // The code below retrieves a contact with the email address "john.doe@example.com".
* var contact = ContactsApp.getContact('john.doe@example.com');
*
*
* @param emailAddress - the email address of the contact
*
* @returns the contact containing that email address
*/
function getContact(
emailAddress: string
): ContactsApp.Contact
/**
* Gets the contact with this id.
*
*
* // The code below retrieves the contact with the id
* // "http://www.google.com/m8/feeds/contacts/john.doe%40example.com/base/7c86afde08d34ca5"
* var id = 'http://www.google.com/m8/feeds/contacts/john.doe%40example.com/base/7c86afde08d34c';
* var contact = ContactApp.getContactById(id);
*
*
* @param id - the id of the contact to retrieve
*
* @returns the matching contact or null
*/
function getContactById(
id: string
): ContactsApp.Contact
/**
* Gets a contact group with the given name, or returns null if no such contact group is found.
*
*
* // The code below returns the contact group with the name "Work Friends"
* var group = ContactsApp.getContactGroup('Work Friends');
*
*
* @param name - the name of the contact group to match
*
* @returns the matching contact group or null if no matching contact group is found
*/
function getContactGroup(
name: string
): ContactsApp.ContactGroup
/**
* Gets a contact group with the given id, or returns null if no such contact group is found.
*
*
* // The code below returns the contact group with the id
* // "http://www.google.com/m8/feeds/groups/john.doe%40example.com/base/54eefbb093fdecb"
* var id = "http://www.google.com/m8/feeds/groups/john.doe%40example.com/base/54eefbb093fdecb";
* var group = ContactsApp.getContactGroupById(id);
*
*
* @param id - the id of the contact group to match
*
* @returns the matching contact group or null if no matching contact group is found
*/
function getContactGroupById(
id: string
): ContactsApp.ContactGroup
/**
* Gets the complete list of the user's contact groups.
*
* A user can have a list of Contacts, and potentially a list of Contact Groups also. Each * Contact Group can contain Contacts. This method returns a list of all the Contact Groups. * *
* // The retrieves all the contract groups for the user and then logs the group name of each
* // contact group.
* var groups = ContactsApp.getContactGroups();
* for (var i = 0; i < groups.length; i++) {
* Logger.log(groups[i].getName());
* }
*
*
* @returns an array of the user's contact groups
*/
function getContactGroups(): ContactsApp.ContactGroup[]
/**
* Gets all of the user's contacts.
*
*
* // The code below will retrieve all the user's contacts
* var contacts = ContactsApp.getContacts();
*
*
* @returns an array of all the user's contacts
*/
function getContacts(): ContactsApp.Contact[]
/**
* Get contacts matching an address.
*
*
* // The code below returns an array of contacts where the contact's address contains
* // "San Francisco'.
* var contacts = ContactsApp.getContactsByAddress('San Francisco');
*
*
* @param query - the string to search for in contact's addresses
*
* @returns an array of matching contacts
*/
function getContactsByAddress(
query: string
): ContactsApp.Contact[]
/**
* Get contacts matching an address, limited to a specific field.
*
*
* // The code below returns an array of contacts where the contact's address contains
* // "San Francisco" in the Home address field.
* var contacts = ContactsApp.getContactsByAddress('San Francisco',
* ContactsApp.Field.HOME_ADDRESS);
*
*
* @param query - the string to search for in contact's addresses
* @param label - the field to search within
*
* @returns an array of matching contacts
*/
function getContactsByAddress(
query: string,
label: ContactsApp.Field
): ContactsApp.Contact[]
/**
* Get contacts matching an address, limited to the specified custom address label.
*
*
* // The code below returns an array of contacts where the contact's address contains
* // "San Francisco" in a custom address label (created by the user) called
* // "vacation".
* var contacts = ContactsApp.getContactsByAddress('San Francisco', 'vacation');
*
*
* @param query - the string to search for in contact's addresses with the specified custom address
* label
* @param label - the custom address label to search within
*
* @returns an array of matching contacts
*/
function getContactsByAddress(
query: string,
label: string
): ContactsApp.Contact[]
/**
* Get contacts matching the company field.
*
*
* // The code below returns an array of contacts where the contact's company field
* // contains "Google".
* var contacts = ContactsApp.getContactsByCompany('Google');
*
*
* @param query - the string to search for in contact's company field
*
* @returns an array of matching contacts
*/
function getContactsByCompany(
query: string
): ContactsApp.Contact[]
/**
* Get contacts matching a given value in a custom field.
*
* The custom field can be specified by a String or as one of the ContactsApp.ExtendedField * values. * *
* // The code below returns an array of contacts where the contact's custom field
* // named "Favorite Sport" contains "tennis".
* var contacts = ContactsApp.getContactsByCustomField('tennis', 'Favorite Sport');
*
*
* @param query - the string to search for in contact's custom field
* @param label - the custom field to search within
*
* @returns an array of matching contacts
*/
function getContactsByCustomField(
query: object,
label: ContactsApp.ExtendedField
): ContactsApp.Contact[]
/**
* Get contacts matching a given month and day for a particular standard field.
*
*
* // The code below returns an array of contacts where the contact's "Birthday" field
* // contains April for the month and 19 for the day.
* var contacts = ContactsApp.getContactsByDate(ContactsApp.Month.APRIL, 19,
* ContactsApp.Field.BIRTHDAY);
*
*
* @param month - the month to match, as one of the values from ContactsApp.Month
* @param day - the day to match
* @param label - the field to search within, from ContactsApp.Field
*
* @returns an array of matching contacts
*/
function getContactsByDate(
month: Month,
day: number,
label: ContactsApp.Field
): ContactsApp.Contact[]
/**
* Get contacts matching a given month, day, and year for a particular standard field.
*
*
* // The code below returns an array of contacts where the contact's "Birthday" field
* // contains April for the month, 19 for the day, and 1950 for the year.
* var contacts = ContactsApp.getContactsByDate(ContactsApp.Month.APRIL, 19, 1950,
* ContactsApp.Field.BIRTHDAY);
*
*
* @param month - the month to match, as one of the values from ContactsApp.Month
* @param day - the day to match
* @param year - the year to match, can be null
* @param label - the field to search within, from ContactsApp.Field
*
* @returns an array of matching contacts
*/
function getContactsByDate(
month: Month,
day: number,
year: number,
label: ContactsApp.Field
): ContactsApp.Contact[]
/**
* Get contacts matching a given month, day, and year for a particular custom field.
*
*
* // The code below returns an array of contacts where the contact's custom "Start Date" field
* // contains April for the month, 19 for the day, and 2011 for the year.
* var contacts = ContactsApp.getContactsByDate(ContactsApp.Month.APRIL, 19, 2011, 'Start Date');
*
*
* @param month - the month to match, as one of the values from ContactsApp.Month
* @param day - the day to match
* @param year - the year to match, can be null
* @param label - the custom field to search within
*
* @returns an array of matching contacts
*/
function getContactsByDate(
month: Month,
day: number,
year: number,
label: string
): ContactsApp.Contact[]
/**
* Get contacts matching a given month and day for a particular custom field.
*
*
* // The code below returns an array of contacts where the contact's custom "Start Date" field
* // contains April for the month and 19 for the day.
* var contacts = ContactsApp.getContactsByDate(ContactsApp.Month.APRIL, 19, 'Start Date');
*
*
* @param month - the month to match, as one of the values from ContactsApp.Month
* @param day - the day to match
* @param label - the custom field to search within
*
* @returns an array of matching contacts
*/
function getContactsByDate(
month: Month,
day: number,
label: string
): ContactsApp.Contact[]
/**
* Get contacts matching an email address.
*
*
* // The code below returns an array of contacts where the contact's email address contains
* // "john.doe@example.com'.
* var contacts = ContactsApp.getContactsByEmailAddress('john.doe@example.com');
*
*
* @param query - the string to search for in contact email addresses
*
* @returns an array of matching contacts
*/
function getContactsByEmailAddress(
query: string
): ContactsApp.Contact[]
/**
* Get contacts matching an email address, limited to a specific field.
*
*
* // The code below returns an array of contacts where the contact's email address contains
* // "john.doe@example.com" in the Home email field.
* var contacts = ContactsApp.getContactsByEmailAddress('john.doe@example.com',
* ContactsApp.Field.HOME_EMAIL);
*
*
* @param query - the string to search for in contact email addresses
* @param label - the field to search within
*
* @returns an array of matching contacts
*/
function getContactsByEmailAddress(
query: string,
label: ContactsApp.Field
): ContactsApp.Contact[]
/**
* Get contacts matching an email address, limited to the specified custom email address label.
*
*
* // The code below returns an array of contacts where the contact's email address contains
* // "john.doe@example.com" in a custom email address label (created by the user) called
* // "alternate".
* var contacts = ContactsApp.getContactsByEmailAddress('john.doe@example.com', 'alternate');
*
*
* @param query - the string to search for in contact email addresses with the specified custom
* email address label
* @param label - the custom email address label to search within
*
* @returns an array of matching contacts
*/
function getContactsByEmailAddress(
query: string,
label: string
): ContactsApp.Contact[]
/**
* Get the contacts in a given ContactGroup.
*
*
* // The code below returns an array of contacts in the ContactGroup with the name
* // "Work Friends".
* var group = ContactsApp.getContactGroup('Work Friends');
* var contacts = ContactsApp.getContactsByGroup(group);
*
*
* @param group - the group of contacts
*
* @returns an array of of contacts in the given group
*/
function getContactsByGroup(
group: ContactsApp.ContactGroup
): ContactsApp.Contact[]
/**
* Get contacts matching an instant messaging address.
*
*
* // The code below returns an array of contacts where the contact's instant messaging address
* // contains "ChatWithJohnDoe" in any instant messaging field.
* var contacts = ContactsApp.getContactsByIM('ChatWithJohnDoe');
*
*
* @param query - the string to search for in contact's instant messaging addresses
*
* @returns an array of matching contacts
*/
function getContactsByIM(
query: string
): ContactsApp.Contact[]
/**
* Get contacts matching an instant messaging address, limited to a specific field.
*
*
* // The code below returns an array of contacts where the contact's instant messaging address
* // contains "ChatWithJohnDoe" in the AIM instant messaging field.
* var contacts = ContactsApp.getContactsByIM('ChatWithJohnDoe',
* ContactsApp.Field.AIM);
*
*
* @param query - the string to search for in contact's instant messaging addresses
* @param label - the field to search within
*
* @returns an array of matching contacts
*/
function getContactsByIM(
query: string,
label: ContactsApp.Field
): ContactsApp.Contact[]
/**
* Get contacts matching an instant messaging address, limited to the specified custom instant
* messaging label.
*
*
* // The code below returns an array of contacts where the contact's instant messaging address
* // contains "ChatWithJohnDoe" in a custom instant messaging label (created by the user) called
* // "eBuddy".
* var contacts = ContactsApp.getContactsByIM('ChatWithJohnDoe', 'eBuddy');
*
*
* @param query - the string to search for in contact's instant messaging addresses with the
* specified custom instant messaging label
* @param label - the custom instant messaging label to search within
*
* @returns an array of matching contacts
*/
function getContactsByIM(
query: string,
label: string
): ContactsApp.Contact[]
/**
* Get contacts matching the job title field.
*
*
* // The code below returns an array of contacts where the contact's job title field
* // contains "Product Manager".
* var contacts = ContactsApp.getContactsByJobTitle('Product Manager');
*
*
* @param query - the string to search for in contact's job title field
*
* @returns an array of matching contacts
*/
function getContactsByJobTitle(
query: string
): ContactsApp.Contact[]
/**
* Get contacts matching a name.
*
*
* // The code below returns an array of contacts where the contact name contains "John"
* var contacts = ContactsApp.getContactsByName('John');
*
*
* @param query - the string to search for in contact names
*
* @returns an array of matching contacts
*/
function getContactsByName(
query: string
): ContactsApp.Contact[]
/**
* Get contacts matching a name, limited to a specific field.
*
*
* // The code below returns an array of contacts where the contact name contains "John"
* // in the Given Name field.
* var contacts = ContactsApp.getContactsByName('John', ContactsApp.Field.GIVEN_NAME);
*
*
* @param query - the string to search for in contact names
* @param label - the field to search within
*
* @returns an array of matching contacts
*/
function getContactsByName(
query: string,
label: ContactsApp.Field
): ContactsApp.Contact[]
/**
* Get contacts matching the notes field.
*
*
* // The code below returns an array of contacts where the contact's notes field
* // contains "sent birthday card".
* var contacts = ContactsApp.getContactsByNotes('sent birthday card');
*
*
* @param query - the string to search for in contact's notes field
*
* @returns an array of matching contacts
*/
function getContactsByNotes(
query: string
): ContactsApp.Contact[]
/**
* Get contacts matching a phone number.
*
* This method will expand out lettered phone numbers, so if you search for '212-555-CODE' and * you have '212-555-2633' in your contacts or vice versa, the method will find the appropriate * contact. * *
* // The code below returns an array of contacts where the contact's phone number contains
* // "212-555-1234' in any phone number field.
* var contacts = ContactsApp.getContactsByPhone('212-555-1234');
*
*
* @param query - the string to search for in contact's phone numbers
*
* @returns an array of matching contacts
*/
function getContactsByPhone(
query: string
): ContactsApp.Contact[]
/**
* Get contacts matching a phone number, limited to a specific field.
*
* This method will expand out lettered phone numbers, so if you search for '212-555-CODE' and * you have '212-555-2633' in your contacts or vice versa, the method will find the appropriate * contact. * *
* // The code below returns an array of contacts where the contact's phone number contains
* // "212-555-1234" in the Home phone number field.
* var contacts = ContactsApp.getContactsByPhone('212-555-1234',
* ContactsApp.Field.HOME_PHONE);
*
*
* @param query - the string to search for in contact's phone numbers
* @param label - the field to search within
*
* @returns an array of matching contacts
*/
function getContactsByPhone(
query: string,
label: ContactsApp.Field
): ContactsApp.Contact[]
/**
* Get contacts matching a phone number, limited to the specified custom phone number label.
*
* This method will expand out lettered phone numbers, so if you search for '212-555-CODE' and * you have '212-555-2633' in your contacts or vice versa, the method will find the appropriate * contact. * *
* // The code below returns an array of contacts where the contact's phone number contains
* // "212-555-1234" in a custom phone number label (created by the user) called
* // "alternate".
* var contacts = ContactsApp.getContactsByPhone('212-555-1234', 'alternate');
*
*
* @param query - the string to search for in contact's phone numbers with the specified custom
* phone number label
* @param label - the custom phone number label to search within
*
* @returns an array of matching contacts
*/
function getContactsByPhone(
query: string,
label: string
): ContactsApp.Contact[]
/**
* Get contacts matching a URL.
*
*
* // The code below returns an array of contacts where the contact's URL contains
* // "www.example.com' in any URL field.
* var contacts = ContactsApp.getContactsByUrl('www.example.com');
*
*
* @param query - the string to search for in contact's URLs
*
* @returns an array of matching contacts
*/
function getContactsByUrl(
query: string
): ContactsApp.Contact[]
/**
* Get contacts matching a URL, limited to a specific field.
*
*
* // The code below returns an array of contacts where the contact's URL contains
* // "www.example.com" in the Work URL field.
* var contacts = ContactsApp.getContactsByUrl('www.example.com',
* ContactsApp.Field.WORK_WEBSITE);
*
*
* @param query - the string to search for in contact's URLs
* @param label - the field to search within
*
* @returns an array of matching contacts
*/
function getContactsByUrl(
query: string,
label: ContactsApp.Field
): ContactsApp.Contact[]
/**
* Get contacts matching a URL, limited to the specified custom URL label.
*
*
* // The code below returns an array of contacts where the contact's URL contains
* // "www.example.com" in a custom URL label (created by the user) called
* // "alternate work".
* var contacts = ContactsApp.getContactsByUrl('www.example.com', 'alternate work');
*
*
* @param query - the string to search for in contact's URLs with the specified custom URL label
* @param label - the custom URL label to search within
*
* @returns an array of matching contacts
*/
function getContactsByUrl(
query: string,
label: string
): ContactsApp.Contact[]
class AddressField {
private constructor();
/**
* Deletes this address field.
*
*
* // The code below deletes the home addresses for a contact named "John Doe"
* var contacts = ContactsApp.getContactsByName('John Doe');
* var homeAddresses = contacts[0].getAddresses(ContactsApp.Field.HOME_ADDRESS);
* for (var i in homeAddresses) {
* homeAddresses[i].deleteAddressField();
* }
*
*/
deleteAddressField(): void
/**
* Get the address for this field.
*
*
* // Logs the address for the 'Home Address' field for contact 'John Doe'.
* // Can be used similarly for other fields that contain addresses.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var homeAddress = contacts[0].getAddresses(ContactsApp.Field.HOME_ADDRESS);
* Logger.log(homeAddress[0].getAddress());
*
*
* @returns the address as a string
*/
getAddress(): string
/**
* Gets the label for this field. This may be a Field, ExtendedField, or a String.
*
*
* // Logs the label for all the address fields associated with contact
* // 'John Doe'. This method can be similarly called for any field that has
* // a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* for (var i = 0; i < addressFields.length; i++) {
* Logger.log(addressFields[i].getLabel());
* }
*
*
* @returns the label for this field
*/
getLabel(): object
/**
* Gets whether this is the primary field value.
*
*
* // Logs whether or not the first address field associated with contact
* // 'John Doe' is labeled as primary. This method can be similarly called
* // for any field.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* Logger.log(addressFields[0].isPrimary());
*
*
* @returns whether this is primary
*/
isPrimary(): Boolean
/**
* Sets the address of this field.
*
*
* // Sets the address for the 'Home Address' field for contact 'John Doe'.
* // Can be used similarly for other fields that contain addresses.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var homeAddress = contacts[0].getAddresses(ContactsApp.Field.HOME_ADDRESS);
* homeAddress[0].setAddress('123 Main St, Raleigh, NC, 27601');
*
*
* @param address - the new address
*
* @returns this field, useful for chaining
*/
setAddress(
address: string
): ContactsApp.AddressField
/**
* Sets this field to primary.
*
*
* // Sets the the first address field associated with contact 'John Doe'
* // as primary. This method can be similarly called for any field.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* addressFields[0].setAsPrimary();
*
*
* @returns this FieldValue for chaining
*/
setAsPrimary(): ContactsApp.AddressField
/**
* Sets the label of this field.
*
*
* // Sets the label to 'Work' for the first address field associated
* // with contact 'John Doe'. This method can be similarly called for any
* // field that has a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* addressFields[0].setLabel(ContactsApp.Field.WORK_ADDRESS);
*
*
* @param field - the new standard label
*
* @returns this FieldValue for chaining
*/
setLabel(
field: ContactsApp.Field
): ContactsApp.AddressField
/**
* Sets the label of this field.
*
*
* // Sets the label to 'Apartment' for the first address field associated
* // with contact 'John Doe'. This method can be similarly called for any
* // field that has a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* addressFields[0].setLabel('Apartment');
*
*
* @param label - the new label for this field
*
* @returns this field, useful for chaining
*/
setLabel(
label: string
): ContactsApp.AddressField
}
class CompanyField {
private constructor();
/**
* Deletes this company field.
*
*
* // Deletes the first company associated with contact 'John Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var company = contacts[0].getCompanies()[0];
* company.deleteCompanyField();
*
*/
deleteCompanyField(): void
/**
* Gets the company name.
*
*
* // Logs company name for all companies associated with contact 'John Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var companies = contacts[0].getCompanies();
* for (var i in companies) {
* Logger.log(companies[i].getCompanyName());
* }
*
*
* @returns the name of the company
*/
getCompanyName(): string
/**
* Gets the job title.
*
*
* // Logs job title for all companies associated with contact 'John Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var companies = contacts[0].getCompanies();
* for (var i in companies) {
* Logger.log(companies[i].getJobTitle());
* }
*
*
* @returns the job title
*/
getJobTitle(): string
/**
* Gets whether this is the primary company.
*
*
* // Logs true or false depending on whether each company is the primary
* // company for contact 'John Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var companies = contacts[0].getCompanies();
* for (var i in companies) {
* Logger.log(companies[i].isPrimary());
* }
*
*
* @returns whether this is primary
*/
isPrimary(): Boolean
/**
* Sets this company as the primary company, and unsets whatever company was previously primary.
*
*
* // Sets the first company associated with contact 'John Doe' as primary
* var contacts = ContactsApp.getContactsByName('John Doe');
* var company = contacts[0].getCompanies()[0];
* company.setAsPrimary();
*
*
* @returns this company field, useful for chaining
*/
setAsPrimary(): ContactsApp.CompanyField
/**
* Sets the company name.
*
*
* // Sets the company name for the first company associated with contact 'John Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var company = contacts[0].getCompanies()[0];
* company.setCompanyName('ACME Corp');
*
*
* @param company - the new name for the company
*
* @returns this company field, useful for chaining
*/
setCompanyName(
company: string
): ContactsApp.CompanyField
/**
* Sets the job title.
*
*
* // Sets the job title for the first company associated with contact 'John Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var company = contacts[0].getCompanies()[0];
* company.setJobTitle('Manager');
*
*
* @param title - the new job title for the contact at this company
*
* @returns this company field, useful for chaining
*/
setJobTitle(
title: string
): ContactsApp.CompanyField
}
class Contact {
private constructor();
/**
* Adds an address to the contact with either a standard or custom label.
*
* The label can be either from ContactsApp.Field or a custom label string. * *
* // The code below retrieves a contact named "John Doe" and adds the address
* // "123 Main St, Some City, NY 10011" with the the ContactsApp.Field.WORK_ADDRESS label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var address = contacts[0].addAddress(ContactsApp.Field.WORK_ADDRESS,
* '123 Main St, Some City, NY 10011');
*
*
* @param label - the label of the new address, either from ContactsApp.Field or a custom string
* @param address - the new address
*
* @returns the newly created field
*/
addAddress(
label: object,
address: string
): ContactsApp.AddressField
/**
* Adds a company to the contact.
*
*
* // The code below retrieves a contact named "John Doe" and adds the company "Google" and the
* // job title "Product Manager".
* var contacts = ContactsApp.getContactsByName('John Doe');
* var url = contacts[0].addCompany('Google', 'Product Manager');
*
*
* @param company - the name of the company to add to this contact
* @param title - the job title associated with this contact for this company
*
* @returns the newly created field
*/
addCompany(
company: string,
title: string
): ContactsApp.CompanyField
/**
* Adds a custom field to the contact with either an extended or custom label.
*
* The label can be either from ContactsApp.ExtendedField or a custom label string. * *
* // The code below retrieves a contact named "John Doe" and adds the custom field
* // ContactsApp.ExtendedField.HOBBY with the value "hiking".
* // Note that ContactsApp.ExtendedField.HOBBY is not the same as a custom field named 'HOBBY'.
* var contacts = ContactsApp.getContactsByName('John Doe');
* contacts[0].addCustomField(ContactsApp.ExtendedField.HOBBY, 'hiking');
*
*
* @param label - the label of the new address, either from ContactsApp.ExtendedField or a custom
* string
* @param content - the value to store in the custom field
*
* @returns the newly created field
*/
addCustomField(
label: object,
content: object
): ContactsApp.CustomField
/**
* Adds a date to the contact with either an standard or custom label.
*
* The label can be either from ContactsApp.Field or a custom label string. * *
* // The code below retrieves a contact named "John Doe" and adds a
* // ContactsApp.ExtendedField.BIRTHDAY with the value "April 19, 1950".
* var contacts = ContactsApp.getContactsByName('John Doe');
* var birthday = contacts[0].addDate(ContactsApp.Field.BIRTHDAY,
* ContactsApp.Month.APRIL, 19, 1950);
*
*
* @param label - the label of the new date, either from ContactsApp.Field or a custom string
* @param month - the month, from ContactApps.Month
* @param day - the day
* @param year - the year
*
* @returns the newly created date
*/
addDate(
label: object,
month: Month,
day: number,
year: number
): ContactsApp.DateField
/**
* Add an email address with a standard label (home, work, etc.) or a custom label
*
*
* // The code below retrieves a contact named "John Doe" and adds the email address
* // "j.doe@example.com" to the ContactsApp.Field.HOME_EMAIL label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var emailField = contacts[0].addEmail(ContactsApp.Field.HOME_EMAIL, 'j.doe@example.com');
*
*
* @param label - the label of the new email, either from ContactsApp.Field or a custom string
* @param address - the new email address
*
* @returns the newly added field
*/
addEmail(
label: object,
address: string
): ContactsApp.EmailField
/**
* Adds an IM address to the contact with either a standard or custom label.
*
* The label can be either from ContactsApp.Field or a custom label string. * *
* // The code below retrieves a contact named "John Doe" and adds the IM address "ChatWithJohn"
* // with the the ContactsApp.Field.AIM label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var email = contacts[0].addIM(ContactsApp.Field.AIM, 'ChatWithJohn');
*
*
* @param label - the label of the new IM address, either from ContactsApp.Field or a custom string
* @param address - the new IM address
*
* @returns the newly created field
*/
addIM(
label: object,
address: string
): ContactsApp.IMField
/**
* Adds a phone number to the contact with either a standard or custom label.
*
* The label can be either from ContactsApp.Field or a custom label string. * *
* // The code below retrieves a contact named "John Doe" and adds the phone number
* // "212-555-1234" with the the ContactsApp.Field.WORK_PHONE label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var phone = contacts[0].addPhone(ContactsApp.Field.WORK_PHONE, '212-555-1234');
*
*
* @param label - the label of the new phone number, either from ContactsApp.Field or a custom
* string
* @param number - the new phone number
*
* @returns the newly created field
*/
addPhone(
label: object,
number: string
): ContactsApp.PhoneField
/**
* Adds this contact to the given contact group.
*
*
* // The code below creates a new contact and then adds it to the contact group named
* // "Work Friends"
* var contact = ContactsApp.createContact('John', 'Doe', 'john.doe@example.com');
* var group = ContactsApp.getContactGroup('Work Friends');
* contact = contact.addToGroup(group);
*
*
* @param group - the contact group to add this contact to
*
* @returns this contact
*/
addToGroup(
group: ContactsApp.ContactGroup
): ContactsApp.Contact
/**
* Adds a URL to the contact with either a standard or custom label.
*
* The label can be either from ContactsApp.Field or a custom label string. * *
* // The code below retrieves a contact named "John Doe" and adds the URL
* // "http://www.example.com" with the the ContactsApp.Field.WORK_WEBSITE label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var url = contacts[0].addUrl(ContactsApp.Field.WORK_WEBSITE, 'http://www.example.com');
*
*
* @param label - the label of the new address, either from ContactsApp.Field or a custom string
* @param url - the new URL
*
* @returns the newly created field
*/
addUrl(
label: object,
url: string
): ContactsApp.UrlField
/**
* Deletes this contact.
*
*
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* contacts[i].deleteContact();
* }
*
*/
deleteContact(): void
/**
* Gets all the addresses for this contact.
*
*
* // The code below logs the addresses of all the contacts whose names contain "John Doe"
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* Logger.log(contacts[i].getAddresses());
* }
*
*
* @returns a list of addresses
*/
getAddresses(): ContactsApp.AddressField[]
/**
* Gets all the addresses for this contact matching a particular field.
*
* The label can be either from ContactsApp.Field or a custom label string. * *
* // The code below retrieves a contact named "John Doe" and logs the addresses
* // associated with that contact that are in the ContactsApp.Field.WORK_ADDRESS label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addresses = contacts[0].getAddresses(ContactsApp.Field.WORK_ADDRESS);
* for (var i in addresses) {
* Logger.log(addresses[i].getAddress());
* }
*
*
* @param label - the label to match, either from ContactsApp.Field or a custom string
*
* @returns a list of addresses
*/
getAddresses(
label: object
): ContactsApp.AddressField[]
/**
* Gets all the companies for this contact.
*
*
* // The code below logs the company names of all the contacts whose names contain "John Doe"
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* var companies = contacts[i].getCompanies();
* for (var j in companies) {
* Logger.log(companies[j].getCompanyName());
* }
* }
*
*
* @returns a list of companies
*/
getCompanies(): ContactsApp.CompanyField[]
/**
* Gets all the contact groups that contain this contact.
*
*
* // The code below gets a contact named "John Doe" and retrieves all the contact groups that
* // the contact belongs to
* var contacts = ContactsApp.getContactsByName('John Doe');
* var groups = contacts[0].getContactGroups();
*
*
* @returns the groups containing this contact
*/
getContactGroups(): ContactsApp.ContactGroup[]
/**
* Gets all the custom fields for this contact.
*
*
* // The code below retrieves a contact named "John Doe" and logs the custom fields
* // associated with that contact
* var contacts = ContactsApp.getContactsByName('John Doe');
* var fields = contacts[0].getCustomFields();
* for (var i in fields) {
* Logger.log(fields[i].getValue());
* }
*
*
* @returns a list of custom fields
*/
getCustomFields(): ContactsApp.CustomField[]
/**
* Gets all the custom fields for this contact matching a particular field.
*
* The label can be either a standard label from ContactsApp.ExtendedField or a custom label * string. * *
* // The code below retrieves a contact named "John Doe" and logs the custom fields
* // associated with that contact that are in the ContactsApp.ExtendedField.HOBBY label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var hobbies = contacts[0].getCustomFields(ContactsApp.ExtendedField.HOBBY);
* for (var i in hobbies) {
* Logger.log(hobbies[i].getValue());
* }
*
*
* @param label - the label to match, either from ContactsApp.ExtendedField or a custom string
*
* @returns a list of custom fields
*/
getCustomFields(
label: object
): ContactsApp.CustomField[]
/**
* Gets all the dates for this contact.
*
*
* // The code below retrieves a contact named "John Doe" and logs the label of the date
* // associated with that contact
* var contacts = ContactsApp.getContactsByName('John Doe');
* var dates = contacts[0].getDates();
* for (var i in dates) {
* Logger.log(dates[i].getLabel());
* }
*
*
* @returns a list of dates
*/
getDates(): ContactsApp.DateField[]
/**
* Gets all the dates for this contact matching a particular field.
*
* The label can be either a standard label from ContactsApp.Field or a custom label string. * *
* // The code below retrieves a contact named "John Doe" and logs the day of the month
* // associated with that contact that are in the ContactsApp.Field.BIRTHDAY label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var birthdays = contacts[0].getDates(ContactsApp.Field.BIRTHDAY);
* for (var i in birthdays) {
* Logger.log(birthdays[i].getDay());
* }
*
*
* @param label - the label to match, either from ContactsApp.Field or a custom string
*
* @returns a list of dates
*/
getDates(
label: object
): ContactsApp.DateField[]
/**
* Gets a list of the email addresses available for this Contact.
*
* @returns a list of email addresses available for this Contact
*/
getEmailAddresses(): string[]
/**
* Gets the email addresses of this contact.
*
*
* // The code below retrieves a contact named "John Doe" and logs the email addresses
* // associated with that contact
* var contacts = ContactsApp.getContactsByName('John Doe');
* var emails = contacts[0].getEmails();
* for (var i in emails) {
* Logger.log(emails[i].getAddress());
* }
*
*
* @returns the list of email addresses for the the contact
*/
getEmails(): ContactsApp.EmailField[]
/**
* Gets the email addresses for this contact matching a particular field.
*
* The label can be either a standard label from ContactsApp.Field or a custom label string. * *
* // The code below retrieves a contact named "John Doe" and logs the email addresses
* // associated with that contact that are in the ContactsApp.Field.HOME_EMAIL label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var emails = contacts[0].getEmails(ContactsApp.Field.HOME_EMAIL);
* for (var i in emails) {
* Logger.log(emails[i].getAddress());
* }
*
*
* @param label - the label to match, either from ContactsApp.Field or a custom string
*
* @returns the list of email addresses for the the contact
*/
getEmails(
label: object
): ContactsApp.EmailField[]
/**
* Gets the family name (last name) of the contact as a string.
*
*
* // The code below logs the family name of all the contacts whose names contain "John"
* var contacts = ContactsApp.getContactsByName('John');
* for (var i in contacts) {
* Logger.log(contacts[i].getFamilyName());
* }
*
*
* @returns the family name of the contact
*/
getFamilyName(): string
/**
* Gets the full name (given name and last name) of the contact as a string.
*
*
* // The code below logs the full name of all the contacts whose names contain "John"
* var contacts = ContactsApp.getContactsByName('John');
* for (var i in contacts) {
* Logger.log(contacts[i].getFullName());
* }
*
*
* @returns the full name of the contact
*/
getFullName(): string
/**
* Gets the given name (first name) of the contact as a string.
*
*
* // The code below logs the given name of all the contacts whose names contain "Smith"
* var contacts = ContactsApp.getContactsByName('Smith');
* for (var i in contacts) {
* Logger.log(contacts[i].getGivenName());
* }
*
*
* @returns the given name of the contact
*/
getGivenName(): string
/**
* Gets the home address of this Contact, or empty string if none exists.
*
* @returns the home address of this Contact, or empty string if none exists
*/
getHomeAddress(): string
/**
* Gets the home fax number of this Contact or empty string if none exists.
*
* @returns the home fax number of this Contact or empty string if none exists
*/
getHomeFax(): string
/**
* Gets the home phone number of this Contact or empty string if none exists.
*
* @returns the home phone number of this Contact or empty string if none exists
*/
getHomePhone(): string
/**
* Gets all the IM addresses for this contact.
*
*
* // The code below logs the IM addresses of all the contacts whose names contain "John Doe"
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* Logger.log(contacts[i].getIMs());
* }
*
*
* @returns a list of IM addresses
*/
getIMs(): ContactsApp.IMField[]
/**
* Gets all the IM addresses for this contact matching a particular field.
*
* The label can be either from ContactsApp.Field or a custom label string. * *
* // The code below retrieves a contact named "John Doe" and logs the IM addresses
* // associated with that contact that are in the ContactsApp.Field.GOOGLE_TALK label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var imAddresses = contacts[0].getIMs(ContactsApp.Field.GOOGLE_TALK);
* for (var i in imAddresses) {
* Logger.log(imAddresses[i].getAddress());
* }
*
*
* @param label - the label to match, either from ContactsApp.Field or a custom string
*
* @returns a list of IM addresses
*/
getIMs(
label: object
): ContactsApp.IMField[]
/**
* Returns the unique id of this contact.
*
*
* var contact = ContactsApp.createContact('John', 'Doe', 'john.doe@example.com');
* var id = contact.getId();
*
*
* @returns the id of this contact
*/
getId(): string
/**
* Gets the contact's initials.
*
*
* // The code below logs the initials of all the contacts whose names contain "John Doe"
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* Logger.log(contacts[i].getInitials());
* }
*
*
* @returns the initials of the contact
*/
getInitials(): string
/**
* Gets the date this contact was last updated.
*
*
* // The code below logs the last updated date of all the contacts whose names contain
* // "John Doe"
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* Logger.log(contacts[i].getLastUpdated());
* }
*
*
* @returns the date this contact was last updated
*/
getLastUpdated(): Date
/**
* Gets the maiden name of the contact as a string.
*
*
* // The code below logs the maiden name of all the contacts whose names contain "Jane"
* var contacts = ContactsApp.getContactsByName('Jane');
* for (var i in contacts) {
* Logger.log(contacts[i].getMaidenName());
* }
*
*
* @returns the maiden name of the contact
*/
getMaidenName(): string
/**
* Gets the middle name of the contact as a string.
*
*
* // The code below logs the middle name of all the contacts whose names contain "Smith"
* var contacts = ContactsApp.getContactsByName('Smith');
* for (var i in contacts) {
* Logger.log(contacts[i].getMiddleName());
* }
*
*
* @returns the middle name of the contact
*/
getMiddleName(): string
/**
* Gets the mobile phone number of this Contact or empty string if none exists.
*
* @returns the mobile phone number of this Contact or empty string if none exists
*/
getMobilePhone(): string
/**
* Gets the nickname of the contact as a string.
*
*
* // The code below logs the nickname of all the contacts whose names contain "John Doe"
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* Logger.log(contacts[i].getNickname());
* }
*
*
* @returns the nickname of the contact
*/
getNickname(): string
/**
* Gets the notes associated with this contact, or an empty string if there are no notes.
*
*
* // The code below logs the notes of all the contacts whose names contain "John Doe"
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* Logger.log(contacts[i].getNotes());
* }
*
*
* @returns the notes associated with this contact
*/
getNotes(): string
/**
* Gets the pager phone number of this Contact or empty string if none exists.
*
* @returns the pager phone number of this Contact or empty string if none exists
*/
getPager(): string
/**
* Gets all the phone numbers for this contact.
*
*
* // The code below logs the phone numbers of all the contacts whose names contain "John Doe"
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* Logger.log(contacts[i].getPhones());
* }
*
*
* @returns a list of phone numbers
*/
getPhones(): ContactsApp.PhoneField[]
/**
* Gets all the phone numbers for this contact matching a particular field.
*
* The label can be either from ContactsApp.Field or a custom label string. * *
* // The code below retrieves a contact named "John Doe" and logs the phone numbers
* // associated with that contact that are in the ContactsApp.Field.WORK_PHONE label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var phones = contacts[0].getPhones(ContactsApp.Field.WORK_PHONE);
* for (var i in phones) {
* Logger.log(phones[i].getPhoneNumber());
* }
*
*
* @param label - the label to match, either from ContactsApp.Field or a custom string
*
* @returns a list of phone numbers
*/
getPhones(
label: object
): ContactsApp.PhoneField[]
/**
* Gets the prefix to the contact's name.
*
*
* // The code below logs the prefix of all the contacts whose names contain "John Doe"
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* Logger.log(contacts[i].getPrefix());
* }
*
*
* @returns the prefix of the contact's name
*/
getPrefix(): string
/**
* Gets the primary email address of the contact as a string.
*
*
* // The code below logs the primary email address of all the contacts whose names contain
* // "John Doe"
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* Logger.log(contacts[i].getPrimaryEmail());
* }
*
*
* @returns the primary email address of the contact
*/
getPrimaryEmail(): string
/**
* Gets the short name of the contact as a string.
*
*
* // The code below logs the short name of all the contacts whose names contain "Johnathan"
* var contacts = ContactsApp.getContactsByName('Johnathan');
* for (var i in contacts) {
* Logger.log(contacts[i].getShortName());
* }
*
*
* @returns the short name of the contact
*/
getShortName(): string
/**
* Gets the suffix to the contact's name.
*
*
* // The code below logs the suffix of all the contacts whose names contain "John Doe"
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* Logger.log(contacts[i].getSuffix());
* }
*
*
* @returns the suffix of the contact's name
*/
getSuffix(): string
/**
* Gets all the URLs for this contact.
*
*
* // The code below logs the URLs of all the contacts whose names contain "John Doe"
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* Logger.log(contacts[i].getUrls());
* }
*
*
* @returns a list of URLs
*/
getUrls(): ContactsApp.UrlField[]
/**
* Gets all the URLs for this contact matching a particular field.
*
* The label can be either from ContactsApp.Field or a custom label string. * *
* // The code below retrieves a contact named "John Doe" and logs the URLs
* // associated with that contact that are in the ContactsApp.Field.WORK_WEBSITE label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var urls = contacts[0].getUrls(ContactsApp.Field.WORK_WEBSITE);
* for (var i in urls) {
* Logger.log(urls[i].getAddress());
* }
*
*
* @param label - the label to match, either from ContactsApp.Field or a custom string
*
* @returns a list of URLs
*/
getUrls(
label: object
): ContactsApp.UrlField[]
/**
* Gets the user defined value associated with the given key.
*
* @param key - the key can be any basic type (String, int, etc.)
*
* @returns the user defined content that has been stored with this key
*/
getUserDefinedField(
key: string
): string
/**
* Gets all the user defined fields for this Contact and returns them as the properties of a
* JavaScript Object.
*
* @returns the user defined fields for this Contact, as properties of a JavaScript Object
*/
getUserDefinedFields(): object
/**
* Gets the work address of this Contact, or empty string if none exists.
*
* @returns the work address of this Contact, or empty string if none exists
*/
getWorkAddress(): string
/**
* Gets the work fax number of this Contact or empty string if none exists.
*
* @returns the work fax number of this Contact or empty string if none exists
*/
getWorkFax(): string
/**
* Gets the work phone number of this Contact or empty string if none exists.
*
* @returns the work phone number of this Contact or empty string if none exists
*/
getWorkPhone(): string
/**
* Removes this contact from the given contact group.
*
*
* // The code below gets all the contacts named "John Doe" and then removes each of them from
* // the "Work Friends" contact group
* var contacts = ContactsApp.getContactsByName('John Doe');
* var group = ContactsApp.getContactGroup('Work Friends');
* for (var i in contacts) {
* contacts[i] = contacts[i].removeFromGroup(group);
* }
*
*
* @param group - the contact group to remove this contact from
*
* @returns this contact
*/
removeFromGroup(
group: ContactsApp.ContactGroup
): ContactsApp.Contact
/**
* Sets the family name (last name) of the contact.
*
*
* // The code below changes the family name of all the contacts whose names are "John Doe"
* // to "Doe-Smith"
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* contacts[i].setFamilyName('Doe-Smith');
* }
*
*
* @param familyName - the new family name of the contact
*
* @returns this contact
*/
setFamilyName(
familyName: string
): ContactsApp.Contact
/**
* Sets the full name (given name and last name) of the contact.
*
*
* // The code below changes the full name of all the contacts whose names are "John Doe"
* // to "Johnny Doe"
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* contacts[i].setFullName('Johnny Doe');
* }
*
*
* @param fullName - the new full name of the contact
*
* @returns this contact
*/
setFullName(
fullName: string
): ContactsApp.Contact
/**
* Sets the given name (first name) of the contact.
*
*
* // The code below changes the given name of all the contacts whose names are "John Doe"
* // to "Johnny"
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* contacts[i].setGivenName('Johnny');
* }
*
*
* @param givenName - the new given name of the contact
*
* @returns this contact
*/
setGivenName(
givenName: string
): ContactsApp.Contact
/**
* Sets the home address of this Contact.
*
* @param addr - the home address to set
*/
setHomeAddress(
addr: string
): void
/**
* Sets the home fax number of this Contact.
*
* @param phone - the home fax number to set
*/
setHomeFax(
phone: string
): void
/**
* Sets the home phone number of this Contact.
*
* @param phone - the home phone number to set
*/
setHomePhone(
phone: string
): void
/**
* Sets the contact's initials.
*
*
* // The code below sets the initials of all the contacts whose names are "Johnathan Doe"
* // to "JD"
* var contacts = ContactsApp.getContactsByName('Johnathan Doe');
* for (var i in contacts) {
* contacts[i].setInitials('JD');
* }
*
*
* @param initials - the new initials of the contact
*
* @returns this contact
*/
setInitials(
initials: string
): ContactsApp.Contact
/**
* Sets the maiden name of the contact.
*
*
* // The code below changes the maiden name of all the contacts whose names are "Jane Doe"
* // to "Smith"
* var contacts = ContactsApp.getContactsByName('Jane Doe');
* for (var i in contacts) {
* contacts[i].setMaidenName('Smith');
* }
*
*
* @param maidenName - the new maiden name of the contact
*
* @returns this contact
*/
setMaidenName(
maidenName: string
): ContactsApp.Contact
/**
* Sets the middle name of the contact.
*
*
* // The code below changes the middle name of all the contacts whose names are "John Doe"
* // to "Danger"
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* contacts[i].setMiddleName('Danger');
* }
*
*
* @param middleName - the new middle name of the contact
*
* @returns this contact
*/
setMiddleName(
middleName: string
): ContactsApp.Contact
/**
* Sets the mobile phone number of this Contact.
*
* @param phone - the mobile phone number to set
*/
setMobilePhone(
phone: string
): void
/**
* Sets the nickname of the contact.
*
*
* // The code below changes the nickname of all the contacts whose names are "John Doe"
* // to "JohnnyD"
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* contacts[i].setNickname('JohnnyD');
* }
*
*
* @param nickname - the new nickname of the contact
*
* @returns this contact
*/
setNickname(
nickname: string
): ContactsApp.Contact
/**
* Sets the notes associated with this contact.
*
*
* // The code below sets the notes of all the contacts whose names are "John Doe"
* // to "Met him at the hackathon"
* var contacts = ContactsApp.getContactsByName('John Doe');
* for (var i in contacts) {
* contacts[i].setNotes('Met him at the hackathon');
* }
*
*
* @param notes - the notes to be stored for this contact
*
* @returns this contact
*/
setNotes(
notes: string
): ContactsApp.Contact
/**
* Sets the pager number of this Contact.
*
* @param phone - the pager number to set
*/
setPager(
phone: string
): void
/**
* Sets the prefix to the contact's name.
*
*
* // The code below sets the prefix of all the contacts whose names are "Johnathan Doe"
* // to "Mr"
* var contacts = ContactsApp.getContactsByName('Johnathan Doe');
* for (var i in contacts) {
* contacts[i].setPrefix('Mr');
* }
*
*
* @param prefix - the new prefix of the contact's name
*
* @returns this contact
*/
setPrefix(
prefix: string
): ContactsApp.Contact
/**
* Sets the primary email address of this Contact.
*
* @param primaryEmail - the primary email address to set
*/
setPrimaryEmail(
primaryEmail: string
): void
/**
* Sets the short name of the contact.
*
*
* // The code below changes the short name of all the contacts whose names are "Johnathan Doe"
* // to "John"
* var contacts = ContactsApp.getContactsByName('Johnathan Doe');
* for (var i in contacts) {
* contacts[i].setShortName('John');
* }
*
*
* @param shortName - the new short name of the contact
*
* @returns this contact
*/
setShortName(
shortName: string
): ContactsApp.Contact
/**
* Sets the suffix to the contact's name.
*
*
* // The code below sets the suffix of all the contacts whose names are "Johnathan Doe"
* // to "Jr"
* var contacts = ContactsApp.getContactsByName('Johnathan Doe');
* for (var i in contacts) {
* contacts[i].setSuffix('Jr');
* }
*
*
* @param suffix - the new suffix of the contact's name
*
* @returns this contact
*/
setSuffix(
suffix: string
): ContactsApp.Contact
/**
* Sets a single user defined field for this Contact, to be stored with a given key.
*
* @param key - the key can be any basic type (String, int, etc.)
* @param value - the value can be any basic type (String, int, etc.)
*/
setUserDefinedField(
key: string,
value: string
): void
/**
* Sets the user defined fields for this Contact with the properties of the given Object.
*
* @param o - an Object with one or more properties in the form {key: value}
*/
setUserDefinedFields(
o: object
): void
/**
* Sets the work address of this Contact.
*
* @param addr - the work address to set
*/
setWorkAddress(
addr: string
): void
/**
* Sets the work fax number of this Contact.
*
* @param phone - the work fax number to set
*/
setWorkFax(
phone: string
): void
/**
* Sets the work phone number of this Contact.
*
* @param phone - the work phone number to set
*/
setWorkPhone(
phone: string
): void
}
class ContactGroup {
private constructor();
/**
* Adds the given contact to this group
*
*
* // The code below creates a new contact and adds it to the "Work Friends" contact group
* var contact = ContactsApp.createContact('John', 'Doe', 'john.doe@example.com');
* var group = ContactsApp.getContactGroup('Work Friends');
* group.addContact(contact);
*
*
* @param contact - the contact to be added to the group
*
* @returns this contact group
*/
addContact(
contact: ContactsApp.Contact
): ContactsApp.ContactGroup
/**
* Deletes this contact group.
*
* Deletes non-system groups only; system groups cannot be deleted. * *
* // The code below retrieves a contact group named "Work Friends" and deletes it
* var group = ContactsApp.getContactGroup('Work Friends');
* group.deleteGroup();
*
*/
deleteGroup(): void
/**
* Gets all the contacts in this contact group.
*
*
* // The code below retrieves all the contacts in the group named "Work Friends"
* var group = ContactsApp.getContactGroup('Work Friends');
* var contacts = group.getContacts();
*
*
* @returns the contacts in this group
*/
getContacts(): ContactsApp.Contact[]
/**
* Returns the name of this group.
*
* @returns the name of this group
*/
getGroupName(): string
/**
* Gets the id of this contact group.
*
*
* // The code below retrieves a contact group named "Work Friends" and gets its id
* var group = ContactsApp.getContactGroup('Work Friends');
* var id = group.getId();
*
*
* @returns the id of this group
*/
getId(): string
/**
* Gets the name of this contact group.
*
*
* // The code below creates a new contact group and then retrieves its name
* var group = ContactsApp.createContactGroup('Work Friends');
* var name = group.getName();
*
*
* @returns this name of this contact group
*/
getName(): string
/**
* Gets a boolean value to determine whether this contact group is a system group (undeletable) or
* not.
*
* Systems groups are a set of groups that are predefined in Google Contacts, such as "My * Contacts", "Family", "Coworkers", etc. The name of a system group usually contains the words * "System Group". * *
* // The code below retrieves two contact groups, then logs whether or not
* // each is a system group.
* var myGroup = ContactsApp.getContactGroup('Work Friends');
* var systemGroup = ContactsApp.getContactGroup('System Group: Coworkers');
* Logger.log(myGroup.isSystemGroup()); // Returns false, if the group exists.
* Logger.log(systemGroup.isSystemGroup()); // Returns true.
*
*
* @returns whether or not this contact group is a system group
*/
isSystemGroup(): Boolean
/**
* Removes the given contact from this group
*
*
* // The code below retrieves all the contacts named "John Doe' and removes them from the
* // "Work Friends" contact group
* var contacts = ContactsApp.getContactsByName('John Doe');
* var group = ContactsApp.getContactGroup('Work Friends');
* for (var i in contacts) {
* group.removeContact(contacts[i]);
* }
*
*
* @param contact - the contact to be removed from the group
*
* @returns this contact group
*/
removeContact(
contact: ContactsApp.Contact
): ContactsApp.ContactGroup
/**
* Sets the name of this group.
*
* @param name - the name to set for this group
*/
setGroupName(
name: string
): void
/**
* Sets the name of this contact group.
*
*
* // The code below retrieves the contact group named "Work Friends" and renames it to
* // "Work Buddies"
* var group = ContactsApp.getContactGroup('Work Friends');
* group.setName('Work Buddies');
*
*
* @param name - the new name for the contact group
*
* @returns this contact group
*/
setName(
name: string
): ContactsApp.ContactGroup
}
class CustomField {
private constructor();
/**
* Deletes this field.
*
*
* var contacts = ContactsApp.getContactsByName('John Doe');
* var fields = contacts[0].getCustomFields();
* for (var i = 0; i < fields.length; i++) {
* if (fields[i].getLabel() == 'foo') {
* fields[i].deleteCustomField();
* }
* }
*
*/
deleteCustomField(): void
/**
* Gets the label for this field. This may be a Field, ExtendedField, or a String.
*
*
* // Logs the label for all the address fields associated with contact
* // 'John Doe'. This method can be similarly called for any field that has
* // a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* for (var i = 0; i < addressFields.length; i++) {
* Logger.log(addressFields[i].getLabel());
* }
*
*
* @returns the label for this field
*/
getLabel(): object
/**
* Gets the value of the field.
*
*
* // Logs the value of all the custom fields for contact 'John Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var fields = contacts[0].getCustomFields();
* for (var i in fields) {
* Logger.log(fields[i].getValue());
* }
*
*
* @returns the value stored in the field
*/
getValue(): object
/**
* Sets the label of this field.
*
*
* // Sets the first custom field associated with contact 'John Doe' to use 'Mail application' as
* // a label, with 'Gmail' as the value.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var field = contacts[0].getCustomFields()[0];
* field.setLabel('Mail application');
* field.setValue('Gmail');
*
*
* @param field - the new standard label
*
* @returns this field, useful for chaining
*/
setLabel(
field: ContactsApp.ExtendedField
): ContactsApp.CustomField
/**
* Sets the label of this field.
*
*
* // Sets the label to 'Apartment' for the first address field associated
* // with contact 'John Doe'. This method can be similarly called for any
* // field that has a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* addressFields[0].setLabel('Apartment');
*
*
* @param label - the new label for this field
*
* @returns this field, useful for chaining
*/
setLabel(
label: string
): ContactsApp.CustomField
/**
* Sets the value of this field.
*
*
* // Sets the first custom field associated with contact 'John Doe' to use 'Mail application' as
* // a label, with 'Gmail' as the value.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var field = contacts[0].getCustomFields()[0];
* field.setLabel('Mail application');
* field.setValue('Gmail');
*
*
* @param value - the new value
*
* @returns this field, useful for chaining
*/
setValue(
value: object
): ContactsApp.CustomField
}
class DateField {
private constructor();
/**
* Deletes this date.
*
*
* // Deletes all the dates that are set for contact 'John Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var dates = contacts[0].getDates();
* for (var i = 0; i < dates.length; i++) {
* dates[i].deleteDateField();
* }
*
*/
deleteDateField(): void
/**
* Gets the day of the month for this date.
*
* Note: For standard JavaScript Date objects the
* getDay() method returns the day of the week instead.
*
*
* // Logs the day of the birthday for contact 'John Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var birthday = contacts[0].getDates(ContactsApp.Field.BIRTHDAY)[0];
* Logger.log(birthday.getDay());
*
*
* @returns the day of the month
*/
getDay(): number
/**
* Gets the label for this field. This may be a Field, ExtendedField, or a String.
*
*
* // Logs the label for all the address fields associated with contact
* // 'John Doe'. This method can be similarly called for any field that has
* // a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* for (var i = 0; i < addressFields.length; i++) {
* Logger.log(addressFields[i].getLabel());
* }
*
*
* @returns the label for this field
*/
getLabel(): object
/**
* Gets the month for this date.
*
*
* // Logs the month of the birthday for contact 'John Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var birthday = contacts[0].getDates(ContactsApp.Field.BIRTHDAY)[0];
* Logger.log(birthday.getMonth());
*
*
* @returns the month
*/
getMonth(): Month
/**
* Gets the year for this date.
*
*
* // Logs the year of the birthday for contact 'John Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var birthday = contacts[0].getDates(ContactsApp.Field.BIRTHDAY)[0];
* Logger.log(birthday.getYear());
*
*
* @returns the year
*/
getYear(): number
/**
* Sets the date to this day, without a year.
*
* This method only applies to date fields that don't require a year, such as birthdays. * *
* // Sets the birthday for contact 'John Doe' to April 1
* var contacts = ContactsApp.getContactsByName('John Doe');
* var birthday = contacts[0].getDates(ContactsApp.Field.BIRTHDAY)[0];
* birthday.setDate(ContactsApp.Month.APRIL, 1);
*
*
* @param month - the month
* @param day - the day
*
* @returns this date, useful for chaining
*/
setDate(
month: Month,
day: number
): ContactsApp.DateField
/**
* Sets the date to this day.
*
*
* // Sets the birthday for contact 'John Doe' to April 1, 1980
* var contacts = ContactsApp.getContactsByName('John Doe');
* var birthday = contacts[0].getDates(ContactsApp.Field.BIRTHDAY)[0];
* birthday.setDate(ContactsApp.Month.APRIL, 1, 1980);
*
*
* @param month - the month
* @param day - the day
* @param year - the year
*
* @returns this date, useful for chaining
*/
setDate(
month: Month,
day: number,
year: number
): ContactsApp.DateField
/**
* Sets the label of this field, such as 'Birthday' or 'Anniversary'.
*
*
* // Retrieves the first date that's set for contact 'John Doe' and re-labels
* // it as an anniversary
* var contacts = ContactsApp.getContactsByName('John Doe');
* var firstDate = contacts[0].getDates()[0];
* firstDate.setLabel(ContactsApp.Field.ANNIVERSARY);
*
*
* @param label - the new standard label
*
* @returns this field, useful for chaining
*/
setLabel(
label: ContactsApp.Field
): ContactsApp.DateField
/**
* Sets the label of this field.
*
*
* // Sets the label to 'Apartment' for the first address field associated
* // with contact 'John Doe'. This method can be similarly called for any
* // field that has a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* addressFields[0].setLabel('Apartment');
*
*
* @param label - the new label for this field
*
* @returns this field, useful for chaining
*/
setLabel(
label: string
): ContactsApp.DateField
}
class EmailField {
private constructor();
/**
* Deletes this email address from the Contact.
*
*
* // Retrieves and deletes the work email address for contact 'John Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var workEmail = contacts[0].getEmails(ContactsApp.Field.WORK_EMAIL);
* workEmail[0].deleteEmailField();
*
*/
deleteEmailField(): void
/**
* Get the address for this field.
*
*
* // Logs the address for the 'Home Address' field for contact 'John Doe'.
* // Can be used similarly for other fields that contain addresses.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var homeAddress = contacts[0].getAddresses(ContactsApp.Field.HOME_ADDRESS);
* Logger.log(homeAddress[0].getAddress());
*
*
* @returns the address as a string
*/
getAddress(): string
/**
* Returns the display name for this email address.
*
*
* // Logs the display name for the the work email address for contact 'John Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var workEmail = contacts[0].getEmails(ContactsApp.Field.WORK_EMAIL);
* Logger.log(workEmail[0].getDisplayName());
*
*
* @returns the display name for this email
*/
getDisplayName(): string
/**
* Gets the label for this field. This may be a Field, ExtendedField, or a String.
*
*
* // Logs the label for all the address fields associated with contact
* // 'John Doe'. This method can be similarly called for any field that has
* // a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* for (var i = 0; i < addressFields.length; i++) {
* Logger.log(addressFields[i].getLabel());
* }
*
*
* @returns the label for this field
*/
getLabel(): object
/**
* Gets whether this is the primary field value.
*
*
* // Logs whether or not the first address field associated with contact
* // 'John Doe' is labeled as primary. This method can be similarly called
* // for any field.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* Logger.log(addressFields[0].isPrimary());
*
*
* @returns whether this is primary
*/
isPrimary(): Boolean
/**
* Sets the address of this field.
*
*
* // Sets the address for the 'Home Address' field for contact 'John Doe'.
* // Can be used similarly for other fields that contain addresses.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var homeAddress = contacts[0].getAddresses(ContactsApp.Field.HOME_ADDRESS);
* homeAddress[0].setAddress('123 Main St, Raleigh, NC, 27601');
*
*
* @param address - the new address
*
* @returns this field, useful for chaining
*/
setAddress(
address: string
): ContactsApp.EmailField
/**
* Sets this field to primary.
*
*
* // Sets the the first address field associated with contact 'John Doe'
* // as primary. This method can be similarly called for any field.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* addressFields[0].setAsPrimary();
*
*
* @returns this FieldValue for chaining
*/
setAsPrimary(): ContactsApp.EmailField
/**
* Sets the display name for this email address.
*
*
* // Sets the display name to 'Doe, John' for the the work email address for contact 'John Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var workEmail = contacts[0].getEmails(ContactsApp.Field.WORK_EMAIL);
* workEmail[0].setDisplayName('Doe, John');
*
*
* @param name - the new display name for this email address
*
* @returns this email field, useful for chaining
*/
setDisplayName(
name: string
): ContactsApp.EmailField
/**
* Sets the label of this field.
*
*
* // Sets the label to 'Work' for the first address field associated
* // with contact 'John Doe'. This method can be similarly called for any
* // field that has a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* addressFields[0].setLabel(ContactsApp.Field.WORK_ADDRESS);
*
*
* @param field - the new standard label
*
* @returns this FieldValue for chaining
*/
setLabel(
field: ContactsApp.Field
): ContactsApp.EmailField
/**
* Sets the label of this field.
*
*
* // Sets the label to 'Apartment' for the first address field associated
* // with contact 'John Doe'. This method can be similarly called for any
* // field that has a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* addressFields[0].setLabel('Apartment');
*
*
* @param label - the new label for this field
*
* @returns this field, useful for chaining
*/
setLabel(
label: string
): ContactsApp.EmailField
}
enum ExtendedField {
/**
* the contact's billing information
*/
BILLING_INFORMATION = "BILLING_INFORMATION",
/**
* the contact's directory server
*/
DIRECTORY_SERVER = "DIRECTORY_SERVER",
/**
* the contact's gender
*/
GENDER = "GENDER",
/**
* the contact's hobby
*/
HOBBY = "HOBBY",
/**
* the contact's home information
*/
HOME = "HOME",
/**
* the contact's language
*/
LANGUAGE = "LANGUAGE",
/**
* the contact's mileage
*/
MILEAGE = "MILEAGE",
/**
* the contact's other information
*/
OTHER = "OTHER",
/**
* the contact's priority
*/
PRIORITY = "PRIORITY",
/**
* the contact's sensitivity
*/
SENSITIVITY = "SENSITIVITY",
/**
* the contact's user information
*/
USER = "USER",
/**
* the contact's work information
*/
WORK = "WORK",
}
enum Field {
/**
* the contact's AIM identifier
*/
AIM = "AIM",
/**
* the contact's anniversary
*/
ANNIVERSARY = "ANNIVERSARY",
/**
* the contact's assistant's phone number
*/
ASSISTANT_PHONE = "ASSISTANT_PHONE",
/**
* the contact's birthday
*/
BIRTHDAY = "BIRTHDAY",
/**
* the contact's blog URL
*/
BLOG = "BLOG",
/**
* the contact's callback phone number
*/
CALLBACK_PHONE = "CALLBACK_PHONE",
/**
* the contact's company
*/
COMPANY = "COMPANY",
/**
* the contact's family (last) name
*/
FAMILY_NAME = "FAMILY_NAME",
/**
* the contact's FTP URL
*/
FTP = "FTP",
/**
* the contact's full name
*/
FULL_NAME = "FULL_NAME",
/**
* the contact's given (first) name
*/
GIVEN_NAME = "GIVEN_NAME",
/**
* the contact's Google Talk identifier
*/
GOOGLE_TALK = "GOOGLE_TALK",
/**
* the contact's Google Voice number
*/
GOOGLE_VOICE = "GOOGLE_VOICE",
/**
* the contact's home address
*/
HOME_ADDRESS = "HOME_ADDRESS",
/**
* the contact's home email address
*/
HOME_EMAIL = "HOME_EMAIL",
/**
* the contact's home fax number
*/
HOME_FAX = "HOME_FAX",
/**
* the contact's home page URL
*/
HOME_PAGE = "HOME_PAGE",
/**
* the contact's home phone number
*/
HOME_PHONE = "HOME_PHONE",
/**
* the contact's home website URL
*/
HOME_WEBSITE = "HOME_WEBSITE",
/**
* the contact's ICQ identifier
*/
ICQ = "ICQ",
/**
* the contact's initials
*/
INITIALS = "INITIALS",
/**
* the contact's Jabber identifier
*/
JABBER = "JABBER",
/**
* the contact's job title
*/
JOB_TITLE = "JOB_TITLE",
/**
* the contact's maiden name
*/
MAIDEN_NAME = "MAIDEN_NAME",
/**
* the contact's main phone number
*/
MAIN_PHONE = "MAIN_PHONE",
/**
* the contact's middle name
*/
MIDDLE_NAME = "MIDDLE_NAME",
/**
* the contact's mobile phone number
*/
MOBILE_PHONE = "MOBILE_PHONE",
/**
* the contact's MSN identifier
*/
MSN = "MSN",
/**
* the contact's nickname
*/
NICKNAME = "NICKNAME",
/**
* notes about the contact
*/
NOTES = "NOTES",
/**
* the contact's pager number
*/
PAGER = "PAGER",
/**
* the prefix for the contact's name
*/
PREFIX = "PREFIX",
/**
* the contact's profile URL
*/
PROFILE = "PROFILE",
/**
* the contact's QQ identifer
*/
QQ = "QQ",
/**
* the contact's short name
*/
SHORT_NAME = "SHORT_NAME",
/**
* the contact's Skype identifier
*/
SKYPE = "SKYPE",
/**
* the suffix for the contact's name
*/
SUFFIX = "SUFFIX",
/**
* the contact's work address
*/
WORK_ADDRESS = "WORK_ADDRESS",
/**
* the contact's work email address
*/
WORK_EMAIL = "WORK_EMAIL",
/**
* the contact's work fax number
*/
WORK_FAX = "WORK_FAX",
/**
* the contact's work phone number
*/
WORK_PHONE = "WORK_PHONE",
/**
* the contact's work website URL
*/
WORK_WEBSITE = "WORK_WEBSITE",
/**
* the contact's Yahoo instant messaging identifier
*/
YAHOO = "YAHOO",
}
enum Gender {
/**
* female gender
*/
FEMALE = "FEMALE",
/**
* male gender
*/
MALE = "MALE",
}
class IMField {
private constructor();
/**
* Deletes this instant messaging field.
*
*
* // Retrieves and deletes the AIM instant messaging field for contact 'John
* // Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var imFields = contacts[0].getIMs(ContactsApp.Field.AIM);
* imFields[0].deleteIMField();
*
*/
deleteIMField(): void
/**
* Get the address for this field.
*
*
* // Logs the address for the 'Home Address' field for contact 'John Doe'.
* // Can be used similarly for other fields that contain addresses.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var homeAddress = contacts[0].getAddresses(ContactsApp.Field.HOME_ADDRESS);
* Logger.log(homeAddress[0].getAddress());
*
*
* @returns the address as a string
*/
getAddress(): string
/**
* Gets the label for this field. This may be a Field, ExtendedField, or a String.
*
*
* // Logs the label for all the address fields associated with contact
* // 'John Doe'. This method can be similarly called for any field that has
* // a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* for (var i = 0; i < addressFields.length; i++) {
* Logger.log(addressFields[i].getLabel());
* }
*
*
* @returns the label for this field
*/
getLabel(): object
/**
* Gets whether this is the primary field value.
*
*
* // Logs whether or not the first address field associated with contact
* // 'John Doe' is labeled as primary. This method can be similarly called
* // for any field.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* Logger.log(addressFields[0].isPrimary());
*
*
* @returns whether this is primary
*/
isPrimary(): Boolean
/**
* Sets the address of this field.
*
*
* // Sets the address for the 'Home Address' field for contact 'John Doe'.
* // Can be used similarly for other fields that contain addresses.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var homeAddress = contacts[0].getAddresses(ContactsApp.Field.HOME_ADDRESS);
* homeAddress[0].setAddress('123 Main St, Raleigh, NC, 27601');
*
*
* @param address - the new address
*
* @returns this field, useful for chaining
*/
setAddress(
address: string
): ContactsApp.IMField
/**
* Sets this field to primary.
*
*
* // Sets the the first address field associated with contact 'John Doe'
* // as primary. This method can be similarly called for any field.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* addressFields[0].setAsPrimary();
*
*
* @returns this FieldValue for chaining
*/
setAsPrimary(): ContactsApp.IMField
/**
* Sets the label of this field.
*
*
* // Sets the label to 'Work' for the first address field associated
* // with contact 'John Doe'. This method can be similarly called for any
* // field that has a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* addressFields[0].setLabel(ContactsApp.Field.WORK_ADDRESS);
*
*
* @param field - the new standard label
*
* @returns this FieldValue for chaining
*/
setLabel(
field: ContactsApp.Field
): ContactsApp.IMField
/**
* Sets the label of this field.
*
*
* // Sets the label to 'Apartment' for the first address field associated
* // with contact 'John Doe'. This method can be similarly called for any
* // field that has a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* addressFields[0].setLabel('Apartment');
*
*
* @param label - the new label for this field
*
* @returns this field, useful for chaining
*/
setLabel(
label: string
): ContactsApp.IMField
}
class PhoneField {
private constructor();
/**
* Deletes this phone number field.
*
*
* // Retrieves and deletes the work phone number field for contact 'John
* // Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var phoneFields = contacts[0].getPhones(ContactsApp.Field.WORK_PHONE);
* phoneFields[0].deletePhoneField();
*
*/
deletePhoneField(): void
/**
* Gets the label for this field. This may be a Field, ExtendedField, or a String.
*
*
* // Logs the label for all the address fields associated with contact
* // 'John Doe'. This method can be similarly called for any field that has
* // a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* for (var i = 0; i < addressFields.length; i++) {
* Logger.log(addressFields[i].getLabel());
* }
*
*
* @returns the label for this field
*/
getLabel(): object
/**
* Get the phone number for this field.
*
*
* // Logs the work phone number for contact 'John Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var phoneFields = contacts[0].getPhones(ContactsApp.Field.WORK_PHONE);
* Logger.log(phoneFields[0].getPhoneNumber());
*
*
* @returns the number as a string
*/
getPhoneNumber(): string
/**
* Gets whether this is the primary field value.
*
*
* // Logs whether or not the first address field associated with contact
* // 'John Doe' is labeled as primary. This method can be similarly called
* // for any field.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* Logger.log(addressFields[0].isPrimary());
*
*
* @returns whether this is primary
*/
isPrimary(): Boolean
/**
* Sets this field to primary.
*
*
* // Sets the the first address field associated with contact 'John Doe'
* // as primary. This method can be similarly called for any field.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* addressFields[0].setAsPrimary();
*
*
* @returns this FieldValue for chaining
*/
setAsPrimary(): ContactsApp.PhoneField
/**
* Sets the label of this field.
*
*
* // Sets the label to 'Work' for the first address field associated
* // with contact 'John Doe'. This method can be similarly called for any
* // field that has a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* addressFields[0].setLabel(ContactsApp.Field.WORK_ADDRESS);
*
*
* @param field - the new standard label
*
* @returns this FieldValue for chaining
*/
setLabel(
field: ContactsApp.Field
): ContactsApp.PhoneField
/**
* Sets the label of this field.
*
*
* // Sets the label to 'Apartment' for the first address field associated
* // with contact 'John Doe'. This method can be similarly called for any
* // field that has a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* addressFields[0].setLabel('Apartment');
*
*
* @param label - the new label for this field
*
* @returns this field, useful for chaining
*/
setLabel(
label: string
): ContactsApp.PhoneField
/**
* Sets the phone number for this field.
*
*
* // Sets the work phone number for contact 'John Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var phoneFields = contacts[0].getPhones(ContactsApp.Field.WORK_PHONE);
* phoneFields[0].setPhoneNumber('212-555-1234');
*
*
* @param number - the new number
*
* @returns this field, useful for chaining
*/
setPhoneNumber(
number: string
): ContactsApp.PhoneField
}
enum Priority {
/**
* high priority
*/
HIGH = "HIGH",
/**
* low priority
*/
LOW = "LOW",
/**
* normal priority
*/
NORMAL = "NORMAL",
}
enum Sensitivity {
/**
* confidential sensitivity
*/
CONFIDENTIAL = "CONFIDENTIAL",
/**
* normal sensitivity
*/
NORMAL = "NORMAL",
/**
* personal sensitivity
*/
PERSONAL = "PERSONAL",
/**
* private sensitivity
*/
PRIVATE = "PRIVATE",
}
class UrlField {
private constructor();
/**
* Deletes this URL field.
*
*
* // Retrieves and deletes the Blog URL field for contact 'John
* // Doe'
* var contacts = ContactsApp.getContactsByName('John Doe');
* var urlFields = contacts[0].getUrls(ContactsApp.Field.BLOG);
* urlFields[0].deleteUrlField();
*
*/
deleteUrlField(): void
/**
* Get the address for this field.
*
*
* // Logs the address for the 'Home Address' field for contact 'John Doe'.
* // Can be used similarly for other fields that contain addresses.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var homeAddress = contacts[0].getAddresses(ContactsApp.Field.HOME_ADDRESS);
* Logger.log(homeAddress[0].getAddress());
*
*
* @returns the address as a string
*/
getAddress(): string
/**
* Gets the label for this field. This may be a Field, ExtendedField, or a String.
*
*
* // Logs the label for all the address fields associated with contact
* // 'John Doe'. This method can be similarly called for any field that has
* // a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* for (var i = 0; i < addressFields.length; i++) {
* Logger.log(addressFields[i].getLabel());
* }
*
*
* @returns the label for this field
*/
getLabel(): object
/**
* Gets whether this is the primary field value.
*
*
* // Logs whether or not the first address field associated with contact
* // 'John Doe' is labeled as primary. This method can be similarly called
* // for any field.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* Logger.log(addressFields[0].isPrimary());
*
*
* @returns whether this is primary
*/
isPrimary(): Boolean
/**
* Sets the address of this field.
*
*
* // Sets the address for the 'Home Address' field for contact 'John Doe'.
* // Can be used similarly for other fields that contain addresses.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var homeAddress = contacts[0].getAddresses(ContactsApp.Field.HOME_ADDRESS);
* homeAddress[0].setAddress('123 Main St, Raleigh, NC, 27601');
*
*
* @param address - the new address
*
* @returns this field, useful for chaining
*/
setAddress(
address: string
): ContactsApp.UrlField
/**
* Sets this field to primary.
*
*
* // Sets the the first address field associated with contact 'John Doe'
* // as primary. This method can be similarly called for any field.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* addressFields[0].setAsPrimary();
*
*
* @returns this FieldValue for chaining
*/
setAsPrimary(): ContactsApp.UrlField
/**
* Sets the label of this field.
*
*
* // Sets the label to 'Work' for the first address field associated
* // with contact 'John Doe'. This method can be similarly called for any
* // field that has a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* addressFields[0].setLabel(ContactsApp.Field.WORK_ADDRESS);
*
*
* @param field - the new standard label
*
* @returns this FieldValue for chaining
*/
setLabel(
field: ContactsApp.Field
): ContactsApp.UrlField
/**
* Sets the label of this field.
*
*
* // Sets the label to 'Apartment' for the first address field associated
* // with contact 'John Doe'. This method can be similarly called for any
* // field that has a label.
* var contacts = ContactsApp.getContactsByName('John Doe');
* var addressFields = contacts[0].getAddresses();
* addressFields[0].setLabel('Apartment');
*
*
* @param label - the new label for this field
*
* @returns this field, useful for chaining
*/
setLabel(
label: string
): ContactsApp.UrlField
}
}