已淘汰。請改用 People API 進階服務
這個類別可讓使用者存取自己的 Google 聯絡人,並建立、移除及更新其中的聯絡人。
已淘汰的屬性
屬性 | 類型 | 說明 |
---|---|---|
Extended |
| |
Field |
| |
Gender |
| |
Month | Month | |
Priority |
| |
Sensitivity |
|
已淘汰的方法
已淘汰的方法
createContact(givenName, familyName, email)
createContact(givenName, familyName, email)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
建立新聯絡人。
// The code below creates a new contact with the name "John Doe" and the email // address "john.doe@example.com". const contact = ContactsApp.createContact( 'John', 'Doe', 'john.doe@example.com', );
參數
名稱 | 類型 | 說明 |
---|---|---|
given | String | 聯絡人的名字 |
family | String | 聯絡人的姓氏 |
email | String | 聯絡人的電子郵件地址 |
回攻員
:新建立的 Contact 物件Contact
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
createContactGroup(name)
createContactGroup(name)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
建立名稱為指定名稱的聯絡人群組
// The code below creates a new contact group named "Work Friends" const group = ContactsApp.createContactGroup('Work Friends');
參數
名稱 | 類型 | 說明 |
---|---|---|
name | String | 新聯絡人群組的名稱 |
回攻員
:新建立的聯絡人群組Contact
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
deleteContact(contact)
deleteContact(contact)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
刪除聯絡人。
// The code below retrieves a contact with the email address // "john.doe@example.com" and then deletes that contact. const contact = ContactsApp.getContact('john.doe@example.com'); ContactsApp.deleteContact(contact);
參數
名稱 | 類型 | 說明 |
---|---|---|
contact |
| 要刪除的聯絡人 |
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
deleteContactGroup(group)
deleteContactGroup(group)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
刪除聯絡人群組
// The code below creates deletes the contact group named "Work Friends" const group = ContactsApp.getContactGroup('Work Friends'); ContactsApp.deleteContactGroup(group);
參數
名稱 | 類型 | 說明 |
---|---|---|
group |
| 要刪除的聯絡人群組 |
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
findByEmailAddress(email)
findByEmailAddress(email)
findContactGroup(name)
findContactGroup(name)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
尋找指定名稱的聯絡人群組。
參數
名稱 | 類型 | 說明 |
---|---|---|
name | String | 要尋找的聯絡人群組名稱 |
回攻員
:與指定名稱相符的聯絡人群組Contact
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
getAllContacts()
getAllContacts()
getContact(emailAddress)
getContact(emailAddress)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
根據電子郵件地址取得聯絡人。
如果有多位聯絡人使用相同的電子郵件地址,這個方法會優先選擇將電子郵件地址標示為主要聯絡人的聯絡人;如果沒有任何聯絡人將電子郵件地址標示為主要聯絡人,或是有多位聯絡人將電子郵件地址標示為主要聯絡人,則會依照排序的聯絡人順序傳回第一個結果。
// The code below retrieves a contact with the email address // "john.doe@example.com". const contact = ContactsApp.getContact('john.doe@example.com');
參數
名稱 | 類型 | 說明 |
---|---|---|
email | String | 聯絡人的電子郵件地址 |
回攻員
:含有該電子郵件地址的聯絡人Contact
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactById(id)
getContactById(id)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得使用此 ID 的聯絡人。
// The code below retrieves the contact with the id // "http://www.google.com/m8/feeds/contacts/john.doe%40example.com/base/7c86afde08d34ca5" const id = 'http://www.google.com/m8/feeds/contacts/john.doe%40example.com/base/7c86afde08d34c'; const contact = ContactsApp.getContactById(id);
參數
名稱 | 類型 | 說明 |
---|---|---|
id | String | 要擷取的聯絡人 ID |
回攻員
:相符的聯絡人或空值Contact
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactGroup(name)
getContactGroup(name)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得具有指定名稱的聯絡人群組,如果找不到這樣的聯絡人群組,則傳回空值。
// The code below returns the contact group with the name "Work Friends" const group = ContactsApp.getContactGroup('Work Friends');
參數
名稱 | 類型 | 說明 |
---|---|---|
name | String | 要比對的聯絡人群組名稱 |
回攻員
:相符的聯絡人群組,如果找不到相符的聯絡人群組,則為空值Contact
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactGroupById(id)
getContactGroupById(id)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得指定 ID 的聯絡人群組,如果找不到這類聯絡人群組,則傳回 null。
// The code below returns the contact group with the id // "http://www.google.com/m8/feeds/groups/john.doe%40example.com/base/54eefbb093fdecb" const id = 'http://www.google.com/m8/feeds/groups/john.doe%40example.com/base/54eefbb093fdecb'; const group = ContactsApp.getContactGroupById(id);
參數
名稱 | 類型 | 說明 |
---|---|---|
id | String | 要比對的聯絡人群組 ID |
回攻員
:相符的聯絡人群組,如果找不到相符的聯絡人群組,則為空值Contact
另請參閱
getContactGroups()
getContactGroups()
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得使用者的完整聯絡人群組清單。
使用者可以擁有聯絡人清單,也可能擁有聯絡人群組清單。每個聯絡人群組都可以包含聯絡人。這個方法會傳回所有聯絡人群組的清單。
// The retrieves all the contract groups for the user and then logs the group // name of each contact group. const groups = ContactsApp.getContactGroups(); for (let i = 0; i < groups.length; i++) { Logger.log(groups[i].getName()); }
回攻員
:使用者聯絡人群組的陣列Contact
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContacts()
getContacts()
getContactsByAddress(query)
getContactsByAddress(query)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合地址的聯絡人。
// The code below returns an array of contacts where the contact's address // contains "San Francisco'. const contacts = ContactsApp.getContactsByAddress('San Francisco');
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 在聯絡地址中搜尋的字串 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByAddress(query, label)
getContactsByAddress(query, label)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合特定地址的聯絡人,但僅限於特定欄位。
// The code below returns an array of contacts where the contact's address // contains "San Francisco" in the Home address field. const contacts = ContactsApp.getContactsByAddress( 'San Francisco', ContactsApp.Field.HOME_ADDRESS, );
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 在聯絡地址中搜尋的字串 |
label |
| 要搜尋的欄位 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByAddress(query, label)
getContactsByAddress(query, 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". const contacts = ContactsApp.getContactsByAddress('San Francisco', 'vacation');
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 在聯絡人地址中搜尋的字串,其中包含指定的自訂地址標籤 |
label | String | 要搜尋的自訂地址標籤 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByCompany(query)
getContactsByCompany(query)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合公司欄位條件的聯絡人。
// The code below returns an array of contacts where the contact's company field // contains "Google". const contacts = ContactsApp.getContactsByCompany('Google');
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 要在聯絡人的公司名稱欄位中搜尋的字串 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByCustomField(query, label)
getContactsByCustomField(query, label)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合自訂欄位中指定值的聯絡人。
您可以使用字串或 ContactsApp.ExtendedField 值之一來指定自訂欄位。
// The code below returns an array of contacts where the contact's custom field // named "Favorite Sport" contains "tennis". const contacts = ContactsApp.getContactsByCustomField( 'tennis', 'Favorite Sport', );
參數
名稱 | 類型 | 說明 |
---|---|---|
query | Object | 在聯絡人的自訂欄位中搜尋的字串 |
label |
| 要搜尋的自訂欄位 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByDate(month, day, label)
getContactsByDate(month, day, label)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合特定標準欄位指定月份和日期的聯絡人。
// The code below returns an array of contacts where the contact's "Birthday" // field contains April for the month and 19 for the day. const contacts = ContactsApp.getContactsByDate( ContactsApp.Month.APRIL, 19, ContactsApp.Field.BIRTHDAY, );
參數
名稱 | 類型 | 說明 |
---|---|---|
month | Month | 要比對的月份,為 ContactsApp.Month 的其中一個值 |
day | Integer | 要比對的日期 |
label |
| 要搜尋的欄位,來自 ContactsApp.Field |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByDate(month, day, year, label)
getContactsByDate(month, day, year, label)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合特定標準欄位中指定月份、日期和年份的聯絡人。
// 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. const contacts = ContactsApp.getContactsByDate( ContactsApp.Month.APRIL, 19, 1950, ContactsApp.Field.BIRTHDAY, );
參數
名稱 | 類型 | 說明 |
---|---|---|
month | Month | 要比對的月份,為 ContactsApp.Month 的其中一個值 |
day | Integer | 要比對的日期 |
year | Integer | 要比對的年份,可為空值 |
label |
| 要搜尋的欄位,來自 ContactsApp.Field |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByDate(month, day, year, label)
getContactsByDate(month, day, year, label)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合特定自訂欄位中指定月份、日期和年份的聯絡人。
// 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. const contacts = ContactsApp.getContactsByDate( ContactsApp.Month.APRIL, 19, 2011, 'Start Date', );
參數
名稱 | 類型 | 說明 |
---|---|---|
month | Month | 要比對的月份,為 ContactsApp.Month 的其中一個值 |
day | Integer | 要比對的日期 |
year | Integer | 要比對的年份,可為空值 |
label | String | 要搜尋的自訂欄位 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByDate(month, day, label)
getContactsByDate(month, day, label)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合特定自訂欄位指定月份和日期的聯絡人。
// 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. const contacts = ContactsApp.getContactsByDate( ContactsApp.Month.APRIL, 19, 'Start Date', );
參數
名稱 | 類型 | 說明 |
---|---|---|
month | Month | 要比對的月份,為 ContactsApp.Month 的其中一個值 |
day | Integer | 要比對的日期 |
label | String | 要搜尋的自訂欄位 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByEmailAddress(query)
getContactsByEmailAddress(query)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合電子郵件地址的聯絡人。
// The code below returns an array of contacts where the contact's email address // contains "john.doe@example.com'. const contacts = ContactsApp.getContactsByEmailAddress('john.doe@example.com');
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 在聯絡人電子郵件地址中搜尋的字串 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByEmailAddress(query, label)
getContactsByEmailAddress(query, label)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合電子郵件地址的聯絡人,但僅限於特定欄位。
// The code below returns an array of contacts where the contact's email address // contains "john.doe@example.com" in the Home email field. const contacts = ContactsApp.getContactsByEmailAddress( 'john.doe@example.com', ContactsApp.Field.HOME_EMAIL, );
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 在聯絡人電子郵件地址中搜尋的字串 |
label |
| 要搜尋的欄位 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByEmailAddress(query, label)
getContactsByEmailAddress(query, 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". const contacts = ContactsApp.getContactsByEmailAddress( 'john.doe@example.com', 'alternate', );
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 在聯絡人電子郵件地址中搜尋的字串,以及指定的自訂電子郵件地址標籤 |
label | String | 自訂電子郵件地址標籤,用於搜尋 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByGroup(group)
getContactsByGroup(group)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得指定 ContactGroup 中的聯絡人。
// The code below returns an array of contacts in the ContactGroup with the name // "Work Friends". const group = ContactsApp.getContactGroup('Work Friends'); const contacts = ContactsApp.getContactsByGroup(group);
參數
名稱 | 類型 | 說明 |
---|---|---|
group |
| 聯絡人群組 |
回攻員
:指定群組中的聯絡人陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByIM(query)
getContactsByIM(query)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合某個即時通訊地址的聯絡人。
// The code below returns an array of contacts where the contact's instant // messaging address contains "ChatWithJohnDoe" in any instant messaging field. const contacts = ContactsApp.getContactsByIM('ChatWithJohnDoe');
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 在聯絡人的即時通訊地址中搜尋的字串 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByIM(query, label)
getContactsByIM(query, label)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合某個特定欄位的即時通訊地址的聯絡人。
// The code below returns an array of contacts where the contact's instant // messaging address contains "ChatWithJohnDoe" in the AIM instant messaging // field. const contacts = ContactsApp.getContactsByIM( 'ChatWithJohnDoe', ContactsApp.Field.AIM, );
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 在聯絡人的即時通訊地址中搜尋的字串 |
label |
| 要搜尋的欄位 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByIM(query, label)
getContactsByIM(query, 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". const contacts = ContactsApp.getContactsByIM('ChatWithJohnDoe', 'eBuddy');
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 在聯絡人的即時通訊地址中搜尋的字串,其中包含指定的自訂即時通訊標籤 |
label | String | 要搜尋的自訂即時通訊標籤 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByJobTitle(query)
getContactsByJobTitle(query)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合職稱欄位條件的聯絡人。
// The code below returns an array of contacts where the contact's job title // field contains "Product Manager". const contacts = ContactsApp.getContactsByJobTitle('Product Manager');
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 在聯絡人的職稱欄位中搜尋的字串 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByName(query)
getContactsByName(query)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合名稱的聯絡人。
// The code below returns an array of contacts where the contact name contains // "John" const contacts = ContactsApp.getContactsByName('John');
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 在聯絡人姓名中搜尋的字串 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByName(query, label)
getContactsByName(query, label)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合名稱的聯絡人,但僅限於特定欄位。
// The code below returns an array of contacts where the contact name contains // "John" in the Given Name field. const contacts = ContactsApp.getContactsByName( 'John', ContactsApp.Field.GIVEN_NAME, );
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 在聯絡人姓名中搜尋的字串 |
label |
| 要搜尋的欄位 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByNotes(query)
getContactsByNotes(query)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合「notes」欄位的聯絡人。
// The code below returns an array of contacts where the contact's notes field // contains "sent birthday card". const contacts = ContactsApp.getContactsByNotes('sent birthday card');
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 在聯絡人的備註欄位中搜尋的字串 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByPhone(query)
getContactsByPhone(query)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合電話號碼的聯絡人。
這個方法會展開含字母的電話號碼,因此如果您搜尋「212-555-CODE」,而聯絡人中含有「212-555-2633」或相反的情況,這個方法就會找到適當的聯絡人。
// The code below returns an array of contacts where the contact's phone number // contains "212-555-1234' in any phone number field. const contacts = ContactsApp.getContactsByPhone('212-555-1234');
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 在聯絡人的電話號碼中搜尋的字串 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByPhone(query, label)
getContactsByPhone(query, label)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合電話號碼的聯絡人,但僅限於特定欄位。
這個方法會展開含字母的電話號碼,因此如果您搜尋「212-555-CODE」,而聯絡人中含有「212-555-2633」或相反的情況,這個方法就會找到適當的聯絡人。
// The code below returns an array of contacts where the contact's phone number // contains "212-555-1234" in the Home phone number field. const contacts = ContactsApp.getContactsByPhone( '212-555-1234', ContactsApp.Field.HOME_PHONE, );
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 在聯絡人的電話號碼中搜尋的字串 |
label |
| 要搜尋的欄位 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByPhone(query, label)
getContactsByPhone(query, label)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合電話號碼的聯絡人,但僅限於指定的自訂電話號碼標籤。
這個方法會展開含字母的電話號碼,因此如果您搜尋「212-555-CODE」,而聯絡人中含有「212-555-2633」或相反的情況,這個方法就會找到適當的聯絡人。
// 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". const contacts = ContactsApp.getContactsByPhone('212-555-1234', 'alternate');
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 在聯絡人的電話號碼中搜尋指定自訂電話號碼標籤的字串 |
label | String | 要搜尋的自訂電話號碼標籤 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByUrl(query)
getContactsByUrl(query)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合網址的聯絡人。
// The code below returns an array of contacts where the contact's URL contains // "www.example.com' in any URL field. const contacts = ContactsApp.getContactsByUrl('www.example.com');
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 要在聯絡人網址中搜尋的字串 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByUrl(query, label)
getContactsByUrl(query, label)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得符合特定網址的聯絡人,僅限於特定欄位。
// The code below returns an array of contacts where the contact's URL contains // "www.example.com" in the Work URL field. const contacts = ContactsApp.getContactsByUrl( 'www.example.com', ContactsApp.Field.WORK_WEBSITE, );
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 要在聯絡人網址中搜尋的字串 |
label |
| 要搜尋的欄位 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
另請參閱
getContactsByUrl(query, label)
getContactsByUrl(query, 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". const contacts = ContactsApp.getContactsByUrl( 'www.example.com', 'alternate work', );
參數
名稱 | 類型 | 說明 |
---|---|---|
query | String | 在聯絡人網址中搜尋的字串,並使用指定的自訂網址標籤 |
label | String | 要搜尋的自訂網址標籤 |
回攻員
:相符聯絡人的陣列Contact[]
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds