Class ContactsApp

  • ContactsApp is deprecated and should not be used for new scripts; use the People API advanced service instead.

  • ContactsApp provided methods for managing Google Contacts, including creating, updating, deleting, and retrieving contacts and contact groups.

  • The documentation details numerous deprecated methods within ContactsApp, categorized by their functionality, like contact management, group management, and searching.

  • Each deprecated method's documentation includes its signature, description, parameters, return value, authorization details, and related links.

  • Developers should migrate to the People API for modern Google Contacts integration within Apps Script projects.

ContactsApp

Deprecated. Instead, use the People API advanced service

This class allows users to access their own Google Contacts and create, remove, and update contacts listed therein.

Deprecated properties

PropertyTypeDescription
ExtendedField(削除) ExtendedField (削除ここまで)
Field(削除) Field (削除ここまで)
Gender(削除) Gender (削除ここまで)
MonthMonth
Priority(削除) Priority (削除ここまで)
Sensitivity(削除) Sensitivity (削除ここまで)

Deprecated methods

MethodReturn typeBrief description
(削除) createContact(givenName, familyName, email) (削除ここまで)(削除) Contact (削除ここまで)Creates a new contact.
(削除) createContactGroup(name) (削除ここまで)(削除) ContactGroup (削除ここまで)Creates a contact group with the given name
// The code below creates a new contact group named "Work Friends"
constgroup=ContactsApp.createContactGroup('Work Friends');
(削除) deleteContact(contact) (削除ここまで)voidDeletes the contact.
(削除) deleteContactGroup(group) (削除ここまで)voidDeletes the contact group
// The code below creates deletes the contact group named "Work Friends"
constgroup=ContactsApp.getContactGroup('Work Friends');
ContactsApp.deleteContactGroup(group);
(削除) findByEmailAddress(email) (削除ここまで)(削除) Contact (削除ここまで)Finds a Contact with the given email address.
(削除) findContactGroup(name) (削除ここまで)(削除) ContactGroup (削除ここまで)Finds a contact group of the given name.
(削除) getAllContacts() (削除ここまで)(削除) Contact[] (削除ここまで)Get all the contacts belonging to this user.
(削除) getContact(emailAddress) (削除ここまで)(削除) Contact (削除ここまで)Gets a contact by the email address.
(削除) getContactById(id) (削除ここまで)(削除) Contact (削除ここまで)Gets the contact with this id.
(削除) getContactGroup(name) (削除ここまで)(削除) ContactGroup (削除ここまで)Gets a contact group with the given name, or returns null if no such contact group is found.
(削除) getContactGroupById(id) (削除ここまで)(削除) ContactGroup (削除ここまで)Gets a contact group with the given id, or returns null if no such contact group is found.
(削除) getContactGroups() (削除ここまで)(削除) ContactGroup[] (削除ここまで)Gets the complete list of the user's contact groups.
(削除) getContacts() (削除ここまで)(削除) Contact[] (削除ここまで)Gets all of the user's contacts.
(削除) getContactsByAddress(query) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching an address.
(削除) getContactsByAddress(query, label) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching an address, limited to a specific field.
(削除) getContactsByAddress(query, label) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching an address, limited to the specified custom address label.
(削除) getContactsByCompany(query) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching the company field.
(削除) getContactsByCustomField(query, label) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching a given value in a custom field.
(削除) getContactsByDate(month, day, label) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching a given month and day for a particular standard field.
(削除) getContactsByDate(month, day, year, label) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching a given month, day, and year for a particular standard field.
(削除) getContactsByDate(month, day, year, label) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching a given month, day, and year for a particular custom field.
(削除) getContactsByDate(month, day, label) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching a given month and day for a particular custom field.
(削除) getContactsByEmailAddress(query) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching an email address.
(削除) getContactsByEmailAddress(query, label) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching an email address, limited to a specific field.
(削除) getContactsByEmailAddress(query, label) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching an email address, limited to the specified custom email address label.
(削除) getContactsByGroup(group) (削除ここまで)(削除) Contact[] (削除ここまで)Get the contacts in a given ContactGroup.
(削除) getContactsByIM(query) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching an instant messaging address.
(削除) getContactsByIM(query, label) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching an instant messaging address, limited to a specific field.
(削除) getContactsByIM(query, label) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching an instant messaging address, limited to the specified custom instant messaging label.
(削除) getContactsByJobTitle(query) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching the job title field.
(削除) getContactsByName(query) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching a name.
(削除) getContactsByName(query, label) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching a name, limited to a specific field.
(削除) getContactsByNotes(query) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching the notes field.
(削除) getContactsByPhone(query) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching a phone number.
(削除) getContactsByPhone(query, label) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching a phone number, limited to a specific field.
(削除) getContactsByPhone(query, label) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching a phone number, limited to the specified custom phone number label.
(削除) getContactsByUrl(query) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching a URL.
(削除) getContactsByUrl(query, label) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching a URL, limited to a specific field.
(削除) getContactsByUrl(query, label) (削除ここまで)(削除) Contact[] (削除ここまで)Get contacts matching a URL, limited to the specified custom URL label.

Deprecated methods

(削除) createContact(givenName, familyName, email) (削除ここまで)

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

Creates a new contact.

// The code below creates a new contact with the name "John Doe" and the email
// address "john.doe@example.com".
constcontact=ContactsApp.createContact(
'John',
'Doe',
'john.doe@example.com',
);

Parameters

NameTypeDescription
givenNameStringthe first name of the contact
familyNameStringthe last name of the contact
emailStringthe email address of the contact

Return

(削除) Contact (削除ここまで) — the newly created Contact object

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) createContactGroup(name) (削除ここまで)

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

Creates a contact group with the given name

// The code below creates a new contact group named "Work Friends"
constgroup=ContactsApp.createContactGroup('Work Friends');

Parameters

NameTypeDescription
nameStringthe name of the new contact group

Return

(削除) ContactGroup (削除ここまで) — the newly created contact group

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) deleteContact(contact) (削除ここまで)

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

Deletes the contact.

// The code below retrieves a contact with the email address
// "john.doe@example.com" and then deletes that contact.
constcontact=ContactsApp.getContact('john.doe@example.com');
ContactsApp.deleteContact(contact);

Parameters

NameTypeDescription
contact(削除) Contact (削除ここまで)the contact to be deleted

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) deleteContactGroup(group) (削除ここまで)

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

Deletes the contact group

// The code below creates deletes the contact group named "Work Friends"
constgroup=ContactsApp.getContactGroup('Work Friends');
ContactsApp.deleteContactGroup(group);

Parameters

NameTypeDescription
group(削除) ContactGroup (削除ここまで)the contact group to delete

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) findByEmailAddress(email) (削除ここまで)

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

Finds a Contact with the given email address.

Parameters

NameTypeDescription
emailStringthe email address of the contact to be found

Return

(削除) Contact (削除ここまで) — the Contact containing that email address

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

(削除) findContactGroup(name) (削除ここまで)

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

Finds a contact group of the given name.

Parameters

NameTypeDescription
nameStringthe name of the contact group to find

Return

(削除) ContactGroup (削除ここまで) — the contact group matching the given name

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

(削除) getAllContacts() (削除ここまで)

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

Get all the contacts belonging to this user.

Return

(削除) Contact[] (削除ここまで) — all the contacts for this user

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

(削除) getContact(emailAddress) (削除ここまで)

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

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".
constcontact=ContactsApp.getContact('john.doe@example.com');

Parameters

NameTypeDescription
emailAddressStringthe email address of the contact

Return

(削除) Contact (削除ここまで) — the contact containing that email address

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactById(id) (削除ここまで)

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

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"
constid=
'http://www.google.com/m8/feeds/contacts/john.doe%40example.com/base/7c86afde08d34c';
constcontact=ContactsApp.getContactById(id);

Parameters

NameTypeDescription
idStringthe id of the contact to retrieve

Return

(削除) Contact (削除ここまで) — the matching contact or null

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactGroup(name) (削除ここまで)

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

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"
constgroup=ContactsApp.getContactGroup('Work Friends');

Parameters

NameTypeDescription
nameStringthe name of the contact group to match

Return

(削除) ContactGroup (削除ここまで) — the matching contact group or null if no matching contact group is found

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactGroupById(id) (削除ここまで)

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

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"
constid=
'http://www.google.com/m8/feeds/groups/john.doe%40example.com/base/54eefbb093fdecb';
constgroup=ContactsApp.getContactGroupById(id);

Parameters

NameTypeDescription
idStringthe id of the contact group to match

Return

(削除) ContactGroup (削除ここまで) — the matching contact group or null if no matching contact group is found

See also


(削除) getContactGroups() (削除ここまで)

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

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.
constgroups=ContactsApp.getContactGroups();
for(leti=0;i < groups.length;i++){
Logger.log(groups[i].getName());
}

Return

(削除) ContactGroup[] (削除ここまで) — an array of the user's contact groups

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContacts() (削除ここまで)

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

Gets all of the user's contacts.

// The code below will retrieve all the user's contacts
constcontacts=ContactsApp.getContacts();

Return

(削除) Contact[] (削除ここまで) — an array of all the user's contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByAddress(query) (削除ここまで)

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

Get contacts matching an address.

// The code below returns an array of contacts where the contact's address
// contains "San Francisco'.
constcontacts=ContactsApp.getContactsByAddress('San Francisco');

Parameters

NameTypeDescription
queryStringthe string to search for in contact's addresses

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByAddress(query, label) (削除ここまで)

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

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.
constcontacts=ContactsApp.getContactsByAddress(
'San Francisco',
ContactsApp.Field.HOME_ADDRESS,
);

Parameters

NameTypeDescription
queryStringthe string to search for in contact's addresses
label(削除) Field (削除ここまで)the field to search within

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByAddress(query, label) (削除ここまで)

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

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".
constcontacts=ContactsApp.getContactsByAddress('San Francisco','vacation');

Parameters

NameTypeDescription
queryStringthe string to search for in contact's addresses with the specified custom address label
labelStringthe custom address label to search within

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByCompany(query) (削除ここまで)

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

Get contacts matching the company field.

// The code below returns an array of contacts where the contact's company field
// contains "Google".
constcontacts=ContactsApp.getContactsByCompany('Google');

Parameters

NameTypeDescription
queryStringthe string to search for in contact's company field

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByCustomField(query, label) (削除ここまで)

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

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".
constcontacts=ContactsApp.getContactsByCustomField(
'tennis',
'Favorite Sport',
);

Parameters

NameTypeDescription
queryObjectthe string to search for in contact's custom field
label(削除) ExtendedField (削除ここまで)the custom field to search within

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByDate(month, day, label) (削除ここまで)

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

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.
constcontacts=ContactsApp.getContactsByDate(
ContactsApp.Month.APRIL,
19,
ContactsApp.Field.BIRTHDAY,
);

Parameters

NameTypeDescription
monthMonth the month to match, as one of the values from ContactsApp.Month
dayIntegerthe day to match
label(削除) Field (削除ここまで)the field to search within, from ContactsApp.Field

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByDate(month, day, year, label) (削除ここまで)

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

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.
constcontacts=ContactsApp.getContactsByDate(
ContactsApp.Month.APRIL,
19,
1950,
ContactsApp.Field.BIRTHDAY,
);

Parameters

NameTypeDescription
monthMonth the month to match, as one of the values from ContactsApp.Month
dayIntegerthe day to match
yearIntegerthe year to match, can be null
label(削除) Field (削除ここまで)the field to search within, from ContactsApp.Field

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByDate(month, day, year, label) (削除ここまで)

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

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.
constcontacts=ContactsApp.getContactsByDate(
ContactsApp.Month.APRIL,
19,
2011,
'Start Date',
);

Parameters

NameTypeDescription
monthMonth the month to match, as one of the values from ContactsApp.Month
dayIntegerthe day to match
yearIntegerthe year to match, can be null
labelStringthe custom field to search within

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByDate(month, day, label) (削除ここまで)

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

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.
constcontacts=ContactsApp.getContactsByDate(
ContactsApp.Month.APRIL,
19,
'Start Date',
);

Parameters

NameTypeDescription
monthMonth the month to match, as one of the values from ContactsApp.Month
dayIntegerthe day to match
labelStringthe custom field to search within

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByEmailAddress(query) (削除ここまで)

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

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'.
constcontacts=ContactsApp.getContactsByEmailAddress('john.doe@example.com');

Parameters

NameTypeDescription
queryStringthe string to search for in contact email addresses

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByEmailAddress(query, label) (削除ここまで)

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

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.
constcontacts=ContactsApp.getContactsByEmailAddress(
'john.doe@example.com',
ContactsApp.Field.HOME_EMAIL,
);

Parameters

NameTypeDescription
queryStringthe string to search for in contact email addresses
label(削除) Field (削除ここまで)the field to search within

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByEmailAddress(query, label) (削除ここまで)

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

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".
constcontacts=ContactsApp.getContactsByEmailAddress(
'john.doe@example.com',
'alternate',
);

Parameters

NameTypeDescription
queryStringthe string to search for in contact email addresses with the specified custom email address label
labelStringthe custom email address label to search within

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByGroup(group) (削除ここまで)

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

Get the contacts in a given ContactGroup.

// The code below returns an array of contacts in the ContactGroup with the name
// "Work Friends".
constgroup=ContactsApp.getContactGroup('Work Friends');
constcontacts=ContactsApp.getContactsByGroup(group);

Parameters

NameTypeDescription
group(削除) ContactGroup (削除ここまで)the group of contacts

Return

(削除) Contact[] (削除ここまで) — an array of contacts in the given group

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByIM(query) (削除ここまで)

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

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.
constcontacts=ContactsApp.getContactsByIM('ChatWithJohnDoe');

Parameters

NameTypeDescription
queryStringthe string to search for in contact's instant messaging addresses

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByIM(query, label) (削除ここまで)

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

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.
constcontacts=ContactsApp.getContactsByIM(
'ChatWithJohnDoe',
ContactsApp.Field.AIM,
);

Parameters

NameTypeDescription
queryStringthe string to search for in contact's instant messaging addresses
label(削除) Field (削除ここまで)the field to search within

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByIM(query, label) (削除ここまで)

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

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".
constcontacts=ContactsApp.getContactsByIM('ChatWithJohnDoe','eBuddy');

Parameters

NameTypeDescription
queryStringthe string to search for in contact's instant messaging addresses with the specified custom instant messaging label
labelStringthe custom instant messaging label to search within

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByJobTitle(query) (削除ここまで)

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

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".
constcontacts=ContactsApp.getContactsByJobTitle('Product Manager');

Parameters

NameTypeDescription
queryStringthe string to search for in contact's job title field

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByName(query) (削除ここまで)

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

Get contacts matching a name.

// The code below returns an array of contacts where the contact name contains
// "John"
constcontacts=ContactsApp.getContactsByName('John');

Parameters

NameTypeDescription
queryStringthe string to search for in contact names

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByName(query, label) (削除ここまで)

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

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.
constcontacts=ContactsApp.getContactsByName(
'John',
ContactsApp.Field.GIVEN_NAME,
);

Parameters

NameTypeDescription
queryStringthe string to search for in contact names
label(削除) Field (削除ここまで)the field to search within

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByNotes(query) (削除ここまで)

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

Get contacts matching the notes field.

// The code below returns an array of contacts where the contact's notes field
// contains "sent birthday card".
constcontacts=ContactsApp.getContactsByNotes('sent birthday card');

Parameters

NameTypeDescription
queryStringthe string to search for in contact's notes field

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByPhone(query) (削除ここまで)

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

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.
constcontacts=ContactsApp.getContactsByPhone('212-555-1234');

Parameters

NameTypeDescription
queryStringthe string to search for in contact's phone numbers

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByPhone(query, label) (削除ここまで)

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

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.
constcontacts=ContactsApp.getContactsByPhone(
'212-555-1234',
ContactsApp.Field.HOME_PHONE,
);

Parameters

NameTypeDescription
queryStringthe string to search for in contact's phone numbers
label(削除) Field (削除ここまで)the field to search within

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByPhone(query, label) (削除ここまで)

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

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".
constcontacts=ContactsApp.getContactsByPhone('212-555-1234','alternate');

Parameters

NameTypeDescription
queryStringthe string to search for in contact's phone numbers with the specified custom phone number label
labelStringthe custom phone number label to search within

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByUrl(query) (削除ここまで)

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

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.
constcontacts=ContactsApp.getContactsByUrl('www.example.com');

Parameters

NameTypeDescription
queryStringthe string to search for in contact's URLs

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByUrl(query, label) (削除ここまで)

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

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.
constcontacts=ContactsApp.getContactsByUrl(
'www.example.com',
ContactsApp.Field.WORK_WEBSITE,
);

Parameters

NameTypeDescription
queryStringthe string to search for in contact's URLs
label(削除) Field (削除ここまで)the field to search within

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also


(削除) getContactsByUrl(query, label) (削除ここまで)

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

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".
constcontacts=ContactsApp.getContactsByUrl(
'www.example.com',
'alternate work',
);

Parameters

NameTypeDescription
queryStringthe string to search for in contact's URLs with the specified custom URL label
labelStringthe custom URL label to search within

Return

(削除) Contact[] (削除ここまで) — an array of matching contacts

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.google.com/m8/feeds

See also

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024年12月03日 UTC.