Class CompanyField

公司欄位

已淘汰。請改用 People API 進階服務

聯絡人中的「公司」欄位。

方法傳回類型簡短說明
deleteCompanyField()void刪除這個公司欄位。
getCompanyName()String取得公司名稱。
getJobTitle()String取得職稱。
isPrimary()Boolean取得是否為主要公司。
setAsPrimary()CompanyField將這個公司設為主要公司,並取消設定先前的主要公司。
setCompanyName(company)CompanyField設定公司名稱。
setJobTitle(title)CompanyField設定職稱。

已淘汰的方法

已淘汰。這個函式已淘汰,不建議在新指令碼中使用。

刪除這個公司欄位。

// 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

已淘汰。這個函式已淘汰,不建議在新指令碼中使用。

取得公司名稱。

// 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

已淘汰。這個函式已淘汰,不建議在新指令碼中使用。

取得職稱。

// 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

已淘汰。這個函式已淘汰,不建議在新指令碼中使用。

取得這是主要公司。

// 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

已淘汰。這個函式已淘汰,不建議在新指令碼中使用。

將這個公司設為主要公司,並取消先前主要公司的設定。

// 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();

回攻員

CompanyField:這個公司欄位,可用於鏈結

授權

使用這個方法的腳本需要具備下列一或多個範圍的授權:

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

已淘汰。這個函式已淘汰,不建議在新指令碼中使用。

設定公司名稱。

// 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');

參數

名稱類型說明
companyString公司的新名稱

回攻員

CompanyField:這個公司欄位,可用於鏈結

授權

使用這個方法的腳本需要具備下列一或多個範圍的授權:

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

已淘汰。這個函式已淘汰,不建議在新指令碼中使用。

設定職稱。

// 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');

參數

名稱類型說明
titleString聯絡人在該公司的新職稱

回攻員

CompanyField:這個公司欄位,可用於鏈結

授權

使用這個方法的腳本需要具備下列一或多個範圍的授權:

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