已淘汰。請改用 People API 進階服務
聯絡人中的「公司」欄位。
已淘汰的方法
方法 | 傳回類型 | 簡短說明 |
---|---|---|
| void | 刪除這個公司欄位。 |
| String | 取得公司名稱。 |
| String | 取得職稱。 |
| Boolean | 取得是否為主要公司。 |
|
| 將這個公司設為主要公司,並取消設定先前的主要公司。 |
|
| 設定公司名稱。 |
|
| 設定職稱。 |
已淘汰的方法
deleteCompanyField()
deleteCompanyField()
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
刪除這個公司欄位。
// Deletes the first company associated with contact 'John Doe' const contacts = ContactsApp.getContactsByName('John Doe'); const company = contacts[0].getCompanies()[0]; company.deleteCompanyField();
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
getCompanyName()
getCompanyName()
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得公司名稱。
// Logs company name for all companies associated with contact 'John Doe' const contacts = ContactsApp.getContactsByName('John Doe'); const companies = contacts[0].getCompanies(); for (const i in companies) { Logger.log(companies[i].getCompanyName()); }
回攻員
String
- 公司名稱
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
getJobTitle()
getJobTitle()
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得職稱。
// Logs job title for all companies associated with contact 'John Doe' const contacts = ContactsApp.getContactsByName('John Doe'); const companies = contacts[0].getCompanies(); for (const i in companies) { Logger.log(companies[i].getJobTitle()); }
回攻員
String
- 職稱
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
isPrimary()
isPrimary()
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
取得這是主要公司。
// Logs true or false depending on whether each company is the primary // company for contact 'John Doe' const contacts = ContactsApp.getContactsByName('John Doe'); const companies = contacts[0].getCompanies(); for (const i in companies) { Logger.log(companies[i].isPrimary()); }
回攻員
Boolean
:是否為主要
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
setAsPrimary()
setAsPrimary()
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
將這個公司設為主要公司,並取消先前主要公司的設定。
// Sets the first company associated with contact 'John Doe' as primary const contacts = ContactsApp.getContactsByName('John Doe'); const company = contacts[0].getCompanies()[0]; company.setAsPrimary();
回攻員
:這個公司欄位,可用於鏈結Company
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
setCompanyName(company)
setCompanyName(company)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
設定公司名稱。
// Sets the company name for the first company associated with contact 'John // Doe' const contacts = ContactsApp.getContactsByName('John Doe'); const company = contacts[0].getCompanies()[0]; company.setCompanyName('ACME Corp');
參數
名稱 | 類型 | 說明 |
---|---|---|
company | String | 公司的新名稱 |
回攻員
:這個公司欄位,可用於鏈結Company
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds
setJobTitle(title)
setJobTitle(title)
已淘汰。這個函式已淘汰,不建議在新指令碼中使用。
設定職稱。
// Sets the job title for the first company associated with contact 'John Doe' const contacts = ContactsApp.getContactsByName('John Doe'); const company = contacts[0].getCompanies()[0]; company.setJobTitle('Manager');
參數
名稱 | 類型 | 說明 |
---|---|---|
title | String | 聯絡人在該公司的新職稱 |
回攻員
:這個公司欄位,可用於鏈結Company
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
-
https://www.google.com/m8/feeds