Contact


**Deprecated.** Instead, use the [People API advanced
service](https://developers.google.com/apps-script/advanced/people)

A Contact contains the name, address, and various contact details of a contact.

### Deprecated methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/contacts/contact#addAddress(Object,String)` | `https://developers.google.com/apps-script/reference/contacts/address-field` | Adds an address to the contact with either a standard or custom label. |
| `https://developers.google.com/apps-script/reference/contacts/contact#addCompany(String,String)` | `https://developers.google.com/apps-script/reference/contacts/company-field` | Adds a company to the contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#addCustomField(Object,Object)` | `https://developers.google.com/apps-script/reference/contacts/custom-field` | Adds a custom field to the contact with either an extended or custom label. |
| `https://developers.google.com/apps-script/reference/contacts/contact#addDate(Object,Month,Integer,Integer)` | `https://developers.google.com/apps-script/reference/contacts/date-field` | Adds a date to the contact with either an standard or custom label. |
| `https://developers.google.com/apps-script/reference/contacts/contact#addEmail(Object,String)` | `https://developers.google.com/apps-script/reference/contacts/email-field` | Add an email address with a standard label (home, work, etc.) or a custom label ```javascript {@code // 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. ``` |
| `https://developers.google.com/apps-script/reference/contacts/contact#addIM(Object,String)` | `https://developers.google.com/apps-script/reference/contacts/im-field` | Adds an IM address to the contact with either a standard or custom label. |
| `https://developers.google.com/apps-script/reference/contacts/contact#addPhone(Object,String)` | `https://developers.google.com/apps-script/reference/contacts/phone-field` | Adds a phone number to the contact with either a standard or custom label. |
| `https://developers.google.com/apps-script/reference/contacts/contact#addToGroup(ContactGroup)` | `https://developers.google.com/apps-script/reference/contacts/contact#` | Adds this contact to the given contact group. |
| `https://developers.google.com/apps-script/reference/contacts/contact#addUrl(Object,String)` | `https://developers.google.com/apps-script/reference/contacts/url-field` | Adds a URL to the contact with either a standard or custom label. |
| `https://developers.google.com/apps-script/reference/contacts/contact#deleteContact()` | `void` | Deletes this contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getAddresses()` | `https://developers.google.com/apps-script/reference/contacts/address-field` | Gets all the addresses for this contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getAddresses(Object)` | `https://developers.google.com/apps-script/reference/contacts/address-field` | Gets all the addresses for this contact matching a particular field. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getCompanies()` | `https://developers.google.com/apps-script/reference/contacts/company-field` | Gets all the companies for this contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getContactGroups()` | `https://developers.google.com/apps-script/reference/contacts/contact-group` | Gets all the contact groups that contain this contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getCustomFields()` | `https://developers.google.com/apps-script/reference/contacts/custom-field` | Gets all the custom fields for this contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getCustomFields(Object)` | `https://developers.google.com/apps-script/reference/contacts/custom-field` | Gets all the custom fields for this contact matching a particular field. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getDates()` | `https://developers.google.com/apps-script/reference/contacts/date-field` | Gets all the dates for this contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getDates(Object)` | `https://developers.google.com/apps-script/reference/contacts/date-field` | Gets all the dates for this contact matching a particular field. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getEmailAddresses()` | `String[]` | Gets a list of the email addresses available for this Contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getEmails()` | `https://developers.google.com/apps-script/reference/contacts/email-field` | Gets the email addresses of this contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getEmails(Object)` | `https://developers.google.com/apps-script/reference/contacts/email-field` | Gets the email addresses for this contact matching a particular field. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getFamilyName()` | `String` | Gets the family name (last name) of the contact as a string. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getFullName()` | `String` | Gets the full name (given name and last name) of the contact as a string. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getGivenName()` | `String` | Gets the given name (first name) of the contact as a string. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getHomeAddress()` | `String` | Gets the home address of this Contact, or empty string if none exists. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getHomeFax()` | `String` | Gets the home fax number of this Contact or empty string if none exists. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getHomePhone()` | `String` | Gets the home phone number of this Contact or empty string if none exists. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getIMs()` | `https://developers.google.com/apps-script/reference/contacts/im-field` | Gets all the IM addresses for this contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getIMs(Object)` | `https://developers.google.com/apps-script/reference/contacts/im-field` | Gets all the IM addresses for this contact matching a particular field. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getId()` | `String` | Returns the unique id of this contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getInitials()` | `String` | Gets the contact's initials. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getLastUpdated()` | `Date` | Gets the date this contact was last updated. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getMaidenName()` | `String` | Gets the maiden name of the contact as a string. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getMiddleName()` | `String` | Gets the middle name of the contact as a string. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getMobilePhone()` | `String` | Gets the mobile phone number of this Contact or empty string if none exists. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getNickname()` | `String` | Gets the nickname of the contact as a string. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getNotes()` | `String` | Gets the notes associated with this contact, or an empty string if there are no notes. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getPager()` | `String` | Gets the pager phone number of this Contact or empty string if none exists. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getPhones()` | `https://developers.google.com/apps-script/reference/contacts/phone-field` | Gets all the phone numbers for this contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getPhones(Object)` | `https://developers.google.com/apps-script/reference/contacts/phone-field` | Gets all the phone numbers for this contact matching a particular field. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getPrefix()` | `String` | Gets the prefix to the contact's name. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getPrimaryEmail()` | `String` | Gets the primary email address of the contact as a string. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getShortName()` | `String` | Gets the short name of the contact as a string. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getSuffix()` | `String` | Gets the suffix to the contact's name. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getUrls()` | `https://developers.google.com/apps-script/reference/contacts/url-field` | Gets all the URLs for this contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getUrls(Object)` | `https://developers.google.com/apps-script/reference/contacts/url-field` | Gets all the URLs for this contact matching a particular field. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getUserDefinedField(String)` | `String` | Gets the user defined value associated with the given key. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getUserDefinedFields()` | `Object` | Gets all the user defined fields for this Contact and returns them as the properties of a JavaScript Object. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getWorkAddress()` | `String` | Gets the work address of this Contact, or empty string if none exists. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getWorkFax()` | `String` | Gets the work fax number of this Contact or empty string if none exists. |
| `https://developers.google.com/apps-script/reference/contacts/contact#getWorkPhone()` | `String` | Gets the work phone number of this Contact or empty string if none exists. |
| `https://developers.google.com/apps-script/reference/contacts/contact#removeFromGroup(ContactGroup)` | `https://developers.google.com/apps-script/reference/contacts/contact#` | Removes this contact from the given contact group. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setFamilyName(String)` | `https://developers.google.com/apps-script/reference/contacts/contact#` | Sets the family name (last name) of the contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setFullName(String)` | `https://developers.google.com/apps-script/reference/contacts/contact#` | Sets the full name (given name and last name) of the contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setGivenName(String)` | `https://developers.google.com/apps-script/reference/contacts/contact#` | Sets the given name (first name) of the contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setHomeAddress(String)` | `void` | Sets the home address of this Contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setHomeFax(String)` | `void` | Sets the home fax number of this Contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setHomePhone(String)` | `void` | Sets the home phone number of this Contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setInitials(String)` | `https://developers.google.com/apps-script/reference/contacts/contact#` | Sets the contact's initials. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setMaidenName(String)` | `https://developers.google.com/apps-script/reference/contacts/contact#` | Sets the maiden name of the contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setMiddleName(String)` | `https://developers.google.com/apps-script/reference/contacts/contact#` | Sets the middle name of the contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setMobilePhone(String)` | `void` | Sets the mobile phone number of this Contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setNickname(String)` | `https://developers.google.com/apps-script/reference/contacts/contact#` | Sets the nickname of the contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setNotes(String)` | `https://developers.google.com/apps-script/reference/contacts/contact#` | Sets the notes associated with this contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setPager(String)` | `void` | Sets the pager number of this Contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setPrefix(String)` | `https://developers.google.com/apps-script/reference/contacts/contact#` | Sets the prefix to the contact's name. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setPrimaryEmail(String)` | `void` | Sets the primary email address of this Contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setShortName(String)` | `https://developers.google.com/apps-script/reference/contacts/contact#` | Sets the short name of the contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setSuffix(String)` | `https://developers.google.com/apps-script/reference/contacts/contact#` | Sets the suffix to the contact's name. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setUserDefinedField(String,String)` | `void` | Sets a single user defined field for this Contact, to be stored with a given key. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setUserDefinedFields(Object)` | `void` | Sets the user defined fields for this Contact with the properties of the given Object. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setWorkAddress(String)` | `void` | Sets the work address of this Contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setWorkFax(String)` | `void` | Sets the work fax number of this Contact. |
| `https://developers.google.com/apps-script/reference/contacts/contact#setWorkPhone(String)` | `void` | Sets the work phone number of this Contact. |

## Deprecated methods

### `addAddress(label, address)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

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.

```javascript
// The code below retrieves a contact named "John Doe" and adds the address
// "123 Main St, Some City, NY 10011" with the ContactsApp.Field.WORK_ADDRESS
// label.
const contacts = ContactsApp.getContactsByName('John Doe');
const address = contacts[0].addAddress(
    ContactsApp.Field.WORK_ADDRESS,
    '123 Main St, Some City, NY 10011',
);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `label` | `Object` | the label of the new address, either from ContactsApp.Field or a custom string |
| `address` | `String` | the new address |

#### Return


`https://developers.google.com/apps-script/reference/contacts/address-field` --- the newly created field

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#getAddresses()`

*** ** * ** ***

### `addCompany(company, title)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Adds a company to the contact.

```javascript
// The code below retrieves a contact named "John Doe" and adds the company
// "Google" and the job title "Product Manager".
const contacts = ContactsApp.getContactsByName('John Doe');
const url = contacts[0].addCompany('Google', 'Product Manager');
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `company` | `String` | the name of the company to add to this contact |
| `title` | `String` | the job title associated with this contact for this company |

#### Return


`https://developers.google.com/apps-script/reference/contacts/company-field` --- the newly created field

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#getCompanies()`

*** ** * ** ***

### `addCustomField(label, content)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

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.

```javascript
// 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'.
const contacts = ContactsApp.getContactsByName('John Doe');
contacts[0].addCustomField(ContactsApp.ExtendedField.HOBBY, 'hiking');
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `label` | `Object` | the label of the new address, either from ContactsApp.ExtendedField or a custom string |
| `content` | `Object` | the value to store in the custom field |

#### Return


`https://developers.google.com/apps-script/reference/contacts/custom-field` --- the newly created field

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#getCustomFields()`

*** ** * ** ***

### `addDate(label, month, day, year)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

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.

```javascript
// The code below retrieves a contact named "John Doe" and adds a
// ContactsApp.ExtendedField.BIRTHDAY with the value "April 19, 1950".
const contacts = ContactsApp.getContactsByName('John Doe');
const birthday = contacts[0].addDate(
    ContactsApp.Field.BIRTHDAY,
    ContactsApp.Month.APRIL,
    19,
    1950,
);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `label` | `Object` | the label of the new date, either from ContactsApp.Field or a custom string |
| `month` | `https://developers.google.com/apps-script/reference/base/month.html` | the month, from ContactApps.Month |
| `day` | `Integer` | the day |
| `year` | `Integer` | the year |

#### Return


`https://developers.google.com/apps-script/reference/contacts/date-field` --- the newly created date

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#getDates()`

*** ** * ** ***

### `addEmail(label, address)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Add an email address with a standard label (home, work, etc.) or a custom label

```javascript
// 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.
const contacts = ContactsApp.getContactsByName('John Doe');
const emailField = contacts[0].addEmail(
    ContactsApp.Field.HOME_EMAIL,
    'j.doe@example.com',
);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `label` | `Object` | the label of the new email, either from ContactsApp.Field or a custom string |
| `address` | `String` | the new email address |

#### Return


`https://developers.google.com/apps-script/reference/contacts/email-field` --- the newly added field

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `addIM(label, address)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

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.

```javascript
// The code below retrieves a contact named "John Doe" and adds the IM address
// "ChatWithJohn" with the ContactsApp.Field.AIM label.
const contacts = ContactsApp.getContactsByName('John Doe');
const email = contacts[0].addIM(ContactsApp.Field.AIM, 'ChatWithJohn');
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `label` | `Object` | the label of the new IM address, either from ContactsApp.Field or a custom string |
| `address` | `String` | the new IM address |

#### Return


`https://developers.google.com/apps-script/reference/contacts/im-field` --- the newly created field

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#getIMs()`

*** ** * ** ***

### `addPhone(label, number)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

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.

```javascript
// The code below retrieves a contact named "John Doe" and adds the phone number
// "212-555-1234" with the ContactsApp.Field.WORK_PHONE label.
const contacts = ContactsApp.getContactsByName('John Doe');
const phone = contacts[0].addPhone(
    ContactsApp.Field.WORK_PHONE,
    '212-555-1234',
);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `label` | `Object` | the label of the new phone number, either from ContactsApp.Field or a custom string |
| `number` | `String` | the new phone number |

#### Return


`https://developers.google.com/apps-script/reference/contacts/phone-field` --- the newly created field

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#getPhones()`

*** ** * ** ***

### `addToGroup(group)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Adds this contact to the given contact group.

```javascript
// The code below creates a new contact and then adds it to the contact group
// named "Work Friends"
let contact = ContactsApp.createContact('John', 'Doe', 'john.doe@example.com');
const group = ContactsApp.getContactGroup('Work Friends');
contact = contact.addToGroup(group);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `group` | `https://developers.google.com/apps-script/reference/contacts/contact-group` | the contact group to add this contact to |

#### Return


`https://developers.google.com/apps-script/reference/contacts/contact#` --- this contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#removeFromGroup(ContactGroup)`

*** ** * ** ***

### `addUrl(label, url)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

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.

```javascript
// The code below retrieves a contact named "John Doe" and adds the URL
// "http://www.example.com" with the ContactsApp.Field.WORK_WEBSITE label.
const contacts = ContactsApp.getContactsByName('John Doe');
const url = contacts[0].addUrl(
    ContactsApp.Field.WORK_WEBSITE,
    'http://www.example.com',
);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `label` | `Object` | the label of the new address, either from ContactsApp.Field or a custom string |
| `url` | `String` | the new URL |

#### Return


`https://developers.google.com/apps-script/reference/contacts/url-field` --- the newly created field

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#getUrls()`

*** ** * ** ***

### `deleteContact()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Deletes this contact.

```javascript
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  contacts[i].deleteContact();
}
```

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `getAddresses()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets all the addresses for this contact.

```javascript
// The code below logs the addresses of all the contacts whose names contain
// "John Doe"
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  Logger.log(contacts[i].getAddresses());
}
```

#### Return


`https://developers.google.com/apps-script/reference/contacts/address-field` --- a list of addresses

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#addAddress(Object,String)`

*** ** * ** ***

### `getAddresses(label)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets all the addresses for this contact matching a particular field.

The label can be either from ContactsApp.Field or a custom label string.

```javascript
// 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.
const contacts = ContactsApp.getContactsByName('John Doe');
const addresses = contacts[0].getAddresses(ContactsApp.Field.WORK_ADDRESS);
for (const i in addresses) {
  Logger.log(addresses[i].getAddress());
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `label` | `Object` | the label to match, either from ContactsApp.Field or a custom string |

#### Return


`https://developers.google.com/apps-script/reference/contacts/address-field` --- a list of addresses

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#addAddress(Object,String)`

*** ** * ** ***

### `getCompanies()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets all the companies for this contact.

```javascript
// The code below logs the company names of all the contacts whose names contain
// "John Doe"
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  const companies = contacts[i].getCompanies();
  for (const j in companies) {
    Logger.log(companies[j].getCompanyName());
  }
}
```

#### Return


`https://developers.google.com/apps-script/reference/contacts/company-field` --- a list of companies

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#addCompany(String,String)`

*** ** * ** ***

### `getContactGroups()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets all the contact groups that contain this contact.

```javascript
// The code below gets a contact named "John Doe" and retrieves all the contact
// groups that the contact belongs to
const contacts = ContactsApp.getContactsByName('John Doe');
const groups = contacts[0].getContactGroups();
```

#### Return


`https://developers.google.com/apps-script/reference/contacts/contact-group` --- the groups containing this contact

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#addToGroup(ContactGroup)`

*** ** * ** ***

### `getCustomFields()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets all the custom fields for this contact.

```javascript
// The code below retrieves a contact named "John Doe" and logs the custom
// fields associated with that contact
const contacts = ContactsApp.getContactsByName('John Doe');
const fields = contacts[0].getCustomFields();
for (const i in fields) {
  Logger.log(fields[i].getValue());
}
```

#### Return


`https://developers.google.com/apps-script/reference/contacts/custom-field` --- a list of custom fields

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#addCustomField(Object,Object)`

*** ** * ** ***

### `getCustomFields(label)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

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.

```javascript
// 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.
const contacts = ContactsApp.getContactsByName('John Doe');
const hobbies = contacts[0].getCustomFields(ContactsApp.ExtendedField.HOBBY);
for (const i in hobbies) {
  Logger.log(hobbies[i].getValue());
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `label` | `Object` | the label to match, either from ContactsApp.ExtendedField or a custom string |

#### Return


`https://developers.google.com/apps-script/reference/contacts/custom-field` --- a list of custom fields

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#addCustomField(Object,Object)`

*** ** * ** ***

### `getDates()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets all the dates for this contact.

```javascript
// The code below retrieves a contact named "John Doe" and logs the label of the
// date associated with that contact
const contacts = ContactsApp.getContactsByName('John Doe');
const dates = contacts[0].getDates();
for (const i in dates) {
  Logger.log(dates[i].getLabel());
}
```

#### Return


`https://developers.google.com/apps-script/reference/contacts/date-field` --- a list of dates

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#addDate(Object,Month,Integer,Integer)`

*** ** * ** ***

### `getDates(label)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

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.

```javascript
// 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.
const contacts = ContactsApp.getContactsByName('John Doe');
const birthdays = contacts[0].getDates(ContactsApp.Field.BIRTHDAY);
for (const i in birthdays) {
  Logger.log(birthdays[i].getDay());
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `label` | `Object` | the label to match, either from ContactsApp.Field or a custom string |

#### Return


`https://developers.google.com/apps-script/reference/contacts/date-field` --- a list of dates

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#addDate(Object,Month,Integer,Integer)`

*** ** * ** ***

### `getEmailAddresses()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets a list of the email addresses available for this Contact.

#### Return


`String[]` --- a list of email addresses available for this Contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `getEmails()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the email addresses of this contact.

```javascript
// The code below retrieves a contact named "John Doe" and logs the email
// addresses associated with that contact
const contacts = ContactsApp.getContactsByName('John Doe');
const emails = contacts[0].getEmails();
for (const i in emails) {
  Logger.log(emails[i].getAddress());
}
```

#### Return


`https://developers.google.com/apps-script/reference/contacts/email-field` --- the list of email addresses for the contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#addEmail(Object,String)`

*** ** * ** ***

### `getEmails(label)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

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.

```javascript
// 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.
const contacts = ContactsApp.getContactsByName('John Doe');
const emails = contacts[0].getEmails(ContactsApp.Field.HOME_EMAIL);
for (const i in emails) {
  Logger.log(emails[i].getAddress());
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `label` | `Object` | the label to match, either from ContactsApp.Field or a custom string |

#### Return


`https://developers.google.com/apps-script/reference/contacts/email-field` --- the list of email addresses for the contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#addEmail(Object,String)`

*** ** * ** ***

### `getFamilyName()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the family name (last name) of the contact as a string.

```javascript
// The code below logs the family name of all the contacts whose names contain
// "John"
const contacts = ContactsApp.getContactsByName('John');
for (const i in contacts) {
  Logger.log(contacts[i].getFamilyName());
}
```

#### Return


`String` --- the family name of the contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#setFamilyName(String)`

*** ** * ** ***

### `getFullName()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the full name (given name and last name) of the contact as a string.

```javascript
// The code below logs the full name of all the contacts whose names contain
// "John"
const contacts = ContactsApp.getContactsByName('John');
for (const i in contacts) {
  Logger.log(contacts[i].getFullName());
}
```

#### Return


`String` --- the full name of the contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#setFullName(String)`

*** ** * ** ***

### `getGivenName()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the given name (first name) of the contact as a string.

```javascript
// The code below logs the given name of all the contacts whose names contain
// "Smith"
const contacts = ContactsApp.getContactsByName('Smith');
for (const i in contacts) {
  Logger.log(contacts[i].getGivenName());
}
```

#### Return


`String` --- the given name of the contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#setGivenName(String)`

*** ** * ** ***

### `getHomeAddress()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the home address of this Contact, or empty string if none exists.

#### Return


`String` --- the home address of this Contact, or empty string if none exists

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `getHomeFax()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the home fax number of this Contact or empty string if none exists.

#### Return


`String` --- the home fax number of this Contact or empty string if none exists

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `getHomePhone()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the home phone number of this Contact or empty string if none exists.

#### Return


`String` --- the home phone number of this Contact or empty string if none exists

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `getIMs()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets all the IM addresses for this contact.

```javascript
// The code below logs the IM addresses of all the contacts whose names contain
// "John Doe"
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  Logger.log(contacts[i].getIMs());
}
```

#### Return


`https://developers.google.com/apps-script/reference/contacts/im-field` --- a list of IM addresses

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#addIM(Object,String)`

*** ** * ** ***

### `getIMs(label)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

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.

```javascript
// 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.
const contacts = ContactsApp.getContactsByName('John Doe');
const imAddresses = contacts[0].getIMs(ContactsApp.Field.GOOGLE_TALK);
for (const i in imAddresses) {
  Logger.log(imAddresses[i].getAddress());
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `label` | `Object` | the label to match, either from ContactsApp.Field or a custom string |

#### Return


`https://developers.google.com/apps-script/reference/contacts/im-field` --- a list of IM addresses

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#addIM(Object,String)`

*** ** * ** ***

### `getId()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Returns the unique id of this contact.

```javascript
const contact = ContactsApp.createContact(
    'John',
    'Doe',
    'john.doe@example.com',
);
const id = contact.getId();
```

#### Return


`String` --- the id of this contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `getInitials()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the contact's initials.

```javascript
// The code below logs the initials of all the contacts whose names contain
// "John Doe"
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  Logger.log(contacts[i].getInitials());
}
```

#### Return


`String` --- the initials of the contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#setInitials(String)`

*** ** * ** ***

### `getLastUpdated()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the date this contact was last updated.

```javascript
// The code below logs the last updated date of all the contacts whose names
// contain "John Doe"
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  Logger.log(contacts[i].getLastUpdated());
}
```

#### Return


`Date` --- the date this contact was last updated

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `getMaidenName()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the maiden name of the contact as a string.

```javascript
// The code below logs the maiden name of all the contacts whose names contain
// "Jane"
const contacts = ContactsApp.getContactsByName('Jane');
for (const i in contacts) {
  Logger.log(contacts[i].getMaidenName());
}
```

#### Return


`String` --- the maiden name of the contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#setMaidenName(String)`

*** ** * ** ***

### `getMiddleName()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the middle name of the contact as a string.

```javascript
// The code below logs the middle name of all the contacts whose names contain
// "Smith"
const contacts = ContactsApp.getContactsByName('Smith');
for (const i in contacts) {
  Logger.log(contacts[i].getMiddleName());
}
```

#### Return


`String` --- the middle name of the contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#setMiddleName(String)`

*** ** * ** ***

### `getMobilePhone()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the mobile phone number of this Contact or empty string if none exists.

#### Return


`String` --- the mobile phone number of this Contact or empty string if none exists

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `getNickname()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the nickname of the contact as a string.

```javascript
// The code below logs the nickname of all the contacts whose names contain
// "John Doe"
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  Logger.log(contacts[i].getNickname());
}
```

#### Return


`String` --- the nickname of the contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#setNickname(String)`

*** ** * ** ***

### `getNotes()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the notes associated with this contact, or an empty string if there are no notes.

```javascript
// The code below logs the notes of all the contacts whose names contain "John
// Doe"
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  Logger.log(contacts[i].getNotes());
}
```

#### Return


`String` --- the notes associated with this contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#setNotes(String)`

*** ** * ** ***

### `getPager()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the pager phone number of this Contact or empty string if none exists.

#### Return


`String` --- the pager phone number of this Contact or empty string if none exists

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `getPhones()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets all the phone numbers for this contact.

```javascript
// The code below logs the phone numbers of all the contacts whose names contain
// "John Doe"
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  Logger.log(contacts[i].getPhones());
}
```

#### Return


`https://developers.google.com/apps-script/reference/contacts/phone-field` --- a list of phone numbers

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#addPhone(Object,String)`

*** ** * ** ***

### `getPhones(label)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

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.

```javascript
// 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.
const contacts = ContactsApp.getContactsByName('John Doe');
const phones = contacts[0].getPhones(ContactsApp.Field.WORK_PHONE);
for (const i in phones) {
  Logger.log(phones[i].getPhoneNumber());
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `label` | `Object` | the label to match, either from ContactsApp.Field or a custom string |

#### Return


`https://developers.google.com/apps-script/reference/contacts/phone-field` --- a list of phone numbers

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#addPhone(Object,String)`

*** ** * ** ***

### `getPrefix()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the prefix to the contact's name.

```javascript
// The code below logs the prefix of all the contacts whose names contain "John
// Doe"
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  Logger.log(contacts[i].getPrefix());
}
```

#### Return


`String` --- the prefix of the contact's name

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#setPrefix(String)`

*** ** * ** ***

### `getPrimaryEmail()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the primary email address of the contact as a string.

```javascript
// The code below logs the primary email address of all the contacts whose names
// contain "John Doe"
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  Logger.log(contacts[i].getPrimaryEmail());
}
```

#### Return


`String` --- the primary email address of the contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `getShortName()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the short name of the contact as a string.

```javascript
// The code below logs the short name of all the contacts whose names contain
// "Johnathan"
const contacts = ContactsApp.getContactsByName('Johnathan');
for (const i in contacts) {
  Logger.log(contacts[i].getShortName());
}
```

#### Return


`String` --- the short name of the contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#setShortName(String)`

*** ** * ** ***

### `getSuffix()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the suffix to the contact's name.

```javascript
// The code below logs the suffix of all the contacts whose names contain "John
// Doe"
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  Logger.log(contacts[i].getSuffix());
}
```

#### Return


`String` --- the suffix of the contact's name

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#setSuffix(String)`

*** ** * ** ***

### `getUrls()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets all the URLs for this contact.

```javascript
// The code below logs the URLs of all the contacts whose names contain "John
// Doe"
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  Logger.log(contacts[i].getUrls());
}
```

#### Return


`https://developers.google.com/apps-script/reference/contacts/url-field` --- a list of URLs

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#addUrl(Object,String)`

*** ** * ** ***

### `getUrls(label)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets all the URLs for this contact matching a particular field.

The label can be either from ContactsApp.Field or a custom label string.

```javascript
// 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.
const contacts = ContactsApp.getContactsByName('John Doe');
const urls = contacts[0].getUrls(ContactsApp.Field.WORK_WEBSITE);
for (const i in urls) {
  Logger.log(urls[i].getAddress());
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `label` | `Object` | the label to match, either from ContactsApp.Field or a custom string |

#### Return


`https://developers.google.com/apps-script/reference/contacts/url-field` --- a list of URLs

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#addUrl(Object,String)`

*** ** * ** ***

### `getUserDefinedField(key)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the user defined value associated with the given key.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `key` | `String` | the key can be any basic type (String, int, etc.) |

#### Return


`String` --- the user defined content that has been stored with this key

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `getUserDefinedFields()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets all the user defined fields for this Contact and returns them as the properties of a
JavaScript Object.

#### Return


`Object` --- the user defined fields for this Contact, as properties of a JavaScript Object

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `getWorkAddress()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the work address of this Contact, or empty string if none exists.

#### Return


`String` --- the work address of this Contact, or empty string if none exists

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `getWorkFax()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the work fax number of this Contact or empty string if none exists.

#### Return


`String` --- the work fax number of this Contact or empty string if none exists

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `getWorkPhone()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Gets the work phone number of this Contact or empty string if none exists.

#### Return


`String` --- the work phone number of this Contact or empty string if none exists

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `removeFromGroup(group)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Removes this contact from the given contact group.

```javascript
// The code below gets all the contacts named "John Doe" and then removes each
// of them from the "Work Friends" contact group
const contacts = ContactsApp.getContactsByName('John Doe');
const group = ContactsApp.getContactGroup('Work Friends');
for (const i in contacts) {
  contacts[i] = contacts[i].removeFromGroup(group);
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `group` | `https://developers.google.com/apps-script/reference/contacts/contact-group` | the contact group to remove this contact from |

#### Return


`https://developers.google.com/apps-script/reference/contacts/contact#` --- this contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#addToGroup(ContactGroup)`

*** ** * ** ***

### `setFamilyName(familyName)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the family name (last name) of the contact.

```javascript
// The code below changes the family name of all the contacts whose names are
// "John Doe" to "Doe-Smith"
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  contacts[i].setFamilyName('Doe-Smith');
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `familyName` | `String` | the new family name of the contact |

#### Return


`https://developers.google.com/apps-script/reference/contacts/contact#` --- this contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#getFamilyName()`

*** ** * ** ***

### `setFullName(fullName)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the full name (given name and last name) of the contact.

```javascript
// The code below changes the full name of all the contacts whose names are
// "John Doe" to "Johnny Doe"
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  contacts[i].setFullName('Johnny Doe');
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `fullName` | `String` | the new full name of the contact |

#### Return


`https://developers.google.com/apps-script/reference/contacts/contact#` --- this contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#getFullName()`

*** ** * ** ***

### `setGivenName(givenName)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the given name (first name) of the contact.

```javascript
// The code below changes the given name of all the contacts whose names are
// "John Doe" to "Johnny"
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  contacts[i].setGivenName('Johnny');
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `givenName` | `String` | the new given name of the contact |

#### Return


`https://developers.google.com/apps-script/reference/contacts/contact#` --- this contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#getGivenName()`

*** ** * ** ***

### `setHomeAddress(addr)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the home address of this Contact.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `addr` | `String` | the home address to set |

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `setHomeFax(phone)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the home fax number of this Contact.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `phone` | `String` | the home fax number to set |

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `setHomePhone(phone)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the home phone number of this Contact.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `phone` | `String` | the home phone number to set |

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `setInitials(initials)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the contact's initials.

```javascript
// The code below sets the initials of all the contacts whose names are
// "Johnathan Doe" to "JD"
const contacts = ContactsApp.getContactsByName('Johnathan Doe');
for (const i in contacts) {
  contacts[i].setInitials('JD');
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `initials` | `String` | the new initials of the contact |

#### Return


`https://developers.google.com/apps-script/reference/contacts/contact#` --- this contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#getInitials()`

*** ** * ** ***

### `setMaidenName(maidenName)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the maiden name of the contact.

```javascript
// The code below changes the maiden name of all the contacts whose names are
// "Jane Doe" to "Smith"
const contacts = ContactsApp.getContactsByName('Jane Doe');
for (const i in contacts) {
  contacts[i].setMaidenName('Smith');
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `maidenName` | `String` | the new maiden name of the contact |

#### Return


`https://developers.google.com/apps-script/reference/contacts/contact#` --- this contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#getMaidenName()`

*** ** * ** ***

### `setMiddleName(middleName)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the middle name of the contact.

```javascript
// The code below changes the middle name of all the contacts whose names are
// "John Doe" to "Danger"
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  contacts[i].setMiddleName('Danger');
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `middleName` | `String` | the new middle name of the contact |

#### Return


`https://developers.google.com/apps-script/reference/contacts/contact#` --- this contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#getMiddleName()`

*** ** * ** ***

### `setMobilePhone(phone)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the mobile phone number of this Contact.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `phone` | `String` | the mobile phone number to set |

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `setNickname(nickname)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the nickname of the contact.

```javascript
// The code below changes the nickname of all the contacts whose names are "John
// Doe" to "JohnnyD"
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  contacts[i].setNickname('JohnnyD');
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `nickname` | `String` | the new nickname of the contact |

#### Return


`https://developers.google.com/apps-script/reference/contacts/contact#` --- this contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#getNickname()`

*** ** * ** ***

### `setNotes(notes)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the notes associated with this contact.

```javascript
// The code below sets the notes of all the contacts whose names are "John Doe"
// to "Met him at the hackathon"
const contacts = ContactsApp.getContactsByName('John Doe');
for (const i in contacts) {
  contacts[i].setNotes('Met him at the hackathon');
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `notes` | `String` | the notes to be stored for this contact |

#### Return


`https://developers.google.com/apps-script/reference/contacts/contact#` --- this contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#getNotes()`

*** ** * ** ***

### `setPager(phone)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the pager number of this Contact.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `phone` | `String` | the pager number to set |

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `setPrefix(prefix)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the prefix to the contact's name.

```javascript
// The code below sets the prefix of all the contacts whose names are "Johnathan
// Doe" to "Mr"
const contacts = ContactsApp.getContactsByName('Johnathan Doe');
for (const i in contacts) {
  contacts[i].setPrefix('Mr');
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `prefix` | `String` | the new prefix of the contact's name |

#### Return


`https://developers.google.com/apps-script/reference/contacts/contact#` --- this contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#getPrefix()`

*** ** * ** ***

### `setPrimaryEmail(primaryEmail)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the primary email address of this Contact.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `primaryEmail` | `String` | the primary email address to set |

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `setShortName(shortName)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the short name of the contact.

```javascript
// The code below changes the short name of all the contacts whose names are
// "Johnathan Doe" to "John"
const contacts = ContactsApp.getContactsByName('Johnathan Doe');
for (const i in contacts) {
  contacts[i].setShortName('John');
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `shortName` | `String` | the new short name of the contact |

#### Return


`https://developers.google.com/apps-script/reference/contacts/contact#` --- this contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#getShortName()`

*** ** * ** ***

### `setSuffix(suffix)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the suffix to the contact's name.

```javascript
// The code below sets the suffix of all the contacts whose names are "Johnathan
// Doe" to "Jr"
const contacts = ContactsApp.getContactsByName('Johnathan Doe');
for (const i in contacts) {
  contacts[i].setSuffix('Jr');
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `suffix` | `String` | the new suffix of the contact's name |

#### Return


`https://developers.google.com/apps-script/reference/contacts/contact#` --- this contact

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

#### See also

- `https://developers.google.com/apps-script/reference/contacts/contact#getSuffix()`

*** ** * ** ***

### `setUserDefinedField(key, value)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets a single user defined field for this Contact, to be stored with a given key.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `key` | `String` | the key can be any basic type (String, int, etc.) |
| `value` | `String` | the value can be any basic type (String, int, etc.) |

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `setUserDefinedFields(o)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the user defined fields for this Contact with the properties of the given Object.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `o` | `Object` | an Object with one or more properties in the form {key: value} |

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `setWorkAddress(addr)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the work address of this Contact.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `addr` | `String` | the work address to set |

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `setWorkFax(phone)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the work fax number of this Contact.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `phone` | `String` | the work fax number to set |

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`

*** ** * ** ***

### `setWorkPhone(phone)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Sets the work phone number of this Contact.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `phone` | `String` | the work phone number to set |

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.google.com/m8/feeds`