Class CompanyField
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
지원 중단된 메서드
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()
지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.
회사 이름을 가져옵니다.
// 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()
지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.
직책을 가져옵니다.
// 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()
지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.
기본 회사인지 여부를 가져옵니다.
// 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()
지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.
이 회사를 기본 회사로 설정하고 이전에 기본 회사였던 회사는 설정 해제합니다.
// 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
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 | 회사의 새 이름 |
리턴
CompanyField
: 체이닝에 유용한 회사 필드입니다.
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.google.com/m8/feeds
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 | 이 회사 담당자의 새 직책 |
리턴
CompanyField
: 체이닝에 유용한 회사 필드입니다.
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.google.com/m8/feeds
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003eThe \u003ccode\u003eCompanyField\u003c/code\u003e object, representing a company field in a contact, is deprecated and should not be used in new scripts.\u003c/p\u003e\n"],["\u003cp\u003eInstead of using \u003ccode\u003eCompanyField\u003c/code\u003e, use the People API advanced service for managing contact information.\u003c/p\u003e\n"],["\u003cp\u003eAll methods associated with \u003ccode\u003eCompanyField\u003c/code\u003e, such as \u003ccode\u003edeleteCompanyField()\u003c/code\u003e, \u003ccode\u003egetCompanyName()\u003c/code\u003e, \u003ccode\u003egetJobTitle()\u003c/code\u003e, \u003ccode\u003eisPrimary()\u003c/code\u003e, \u003ccode\u003esetAsPrimary()\u003c/code\u003e, \u003ccode\u003esetCompanyName()\u003c/code\u003e, and \u003ccode\u003esetJobTitle()\u003c/code\u003e, are deprecated.\u003c/p\u003e\n"],["\u003cp\u003eScripts using these deprecated methods required authorization with the \u003ccode\u003ehttps://www.google.com/m8/feeds\u003c/code\u003e scope.\u003c/p\u003e\n"]]],["The `CompanyField` in Contacts is deprecated; the People API should be used instead. It allowed managing company details for contacts, including deleting the company field, getting the company name and job title, and determining if a company was set as primary. You could also set a company as primary, modify the company name, and change the job title associated with a specific company. All these functions are deprecated, requiring authorization with the `https://www.google.com/m8/feeds` scope.\n"],null,["# Class CompanyField\n\nCompanyField\n\n\n**Deprecated.** Instead, use the [People API advanced\nservice](/apps-script/advanced/people)\n\nCompany field in a Contact. \n\n### Deprecated methods\n\n| Method | Return type | Brief description |\n|----------------------------------------------------|-------------------|-----------------------------------------------------------------------------------------------|\n| [deleteCompanyField()](#deleteCompanyField()) | `void` | Deletes this company field. |\n| [getCompanyName()](#getCompanyName()) | `String` | Gets the company name. |\n| [getJobTitle()](#getJobTitle()) | `String` | Gets the job title. |\n| [isPrimary()](#isPrimary()) | `Boolean` | Gets whether this is the primary company. |\n| [setAsPrimary()](#setAsPrimary()) | [CompanyField](#) | Sets this company as the primary company, and unsets whatever company was previously primary. |\n| [setCompanyName(company)](#setCompanyName(String)) | [CompanyField](#) | Sets the company name. |\n| [setJobTitle(title)](#setJobTitle(String)) | [CompanyField](#) | Sets the job title. |\n\nDeprecated methods\n------------------\n\n### `delete``Company``Field()`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nDeletes this company field.\n\n```javascript\n// Deletes the first company associated with contact 'John Doe'\nconst contacts = ContactsApp.getContactsByName('John Doe');\nconst company = contacts[0].getCompanies()[0];\ncompany.deleteCompanyField();\n```\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.google.com/m8/feeds`\n\n*** ** * ** ***\n\n### `get``Company``Name()`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nGets the company name.\n\n```javascript\n// Logs company name for all companies associated with contact 'John Doe'\nconst contacts = ContactsApp.getContactsByName('John Doe');\nconst companies = contacts[0].getCompanies();\nfor (const i in companies) {\n Logger.log(companies[i].getCompanyName());\n}\n```\n\n#### Return\n\n\n`String` --- the name of the company\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.google.com/m8/feeds`\n\n*** ** * ** ***\n\n### `get``Job``Title()`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nGets the job title.\n\n```javascript\n// Logs job title for all companies associated with contact 'John Doe'\nconst contacts = ContactsApp.getContactsByName('John Doe');\nconst companies = contacts[0].getCompanies();\nfor (const i in companies) {\n Logger.log(companies[i].getJobTitle());\n}\n```\n\n#### Return\n\n\n`String` --- the job title\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.google.com/m8/feeds`\n\n*** ** * ** ***\n\n### `is``Primary()`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nGets whether this is the primary company.\n\n```javascript\n// Logs true or false depending on whether each company is the primary\n// company for contact 'John Doe'\nconst contacts = ContactsApp.getContactsByName('John Doe');\nconst companies = contacts[0].getCompanies();\nfor (const i in companies) {\n Logger.log(companies[i].isPrimary());\n}\n```\n\n#### Return\n\n\n`Boolean` --- whether this is primary\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.google.com/m8/feeds`\n\n*** ** * ** ***\n\n### `set``As``Primary()`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nSets this company as the primary company, and unsets whatever company was previously primary.\n\n```javascript\n// Sets the first company associated with contact 'John Doe' as primary\nconst contacts = ContactsApp.getContactsByName('John Doe');\nconst company = contacts[0].getCompanies()[0];\ncompany.setAsPrimary();\n```\n\n#### Return\n\n\n[CompanyField](#) --- this company field, useful for chaining\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.google.com/m8/feeds`\n\n*** ** * ** ***\n\n### `set``Company``Name(company)`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nSets the company name.\n\n```javascript\n// Sets the company name for the first company associated with contact 'John\n// Doe'\nconst contacts = ContactsApp.getContactsByName('John Doe');\nconst company = contacts[0].getCompanies()[0];\ncompany.setCompanyName('ACME Corp');\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|-----------|----------|------------------------------|\n| `company` | `String` | the new name for the company |\n\n#### Return\n\n\n[CompanyField](#) --- this company field, useful for chaining\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.google.com/m8/feeds`\n\n*** ** * ** ***\n\n### `set``Job``Title(title)`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nSets the job title.\n\n```javascript\n// Sets the job title for the first company associated with contact 'John Doe'\nconst contacts = ContactsApp.getContactsByName('John Doe');\nconst company = contacts[0].getCompanies()[0];\ncompany.setJobTitle('Manager');\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|---------|----------|---------------------------------------------------|\n| `title` | `String` | the new job title for the contact at this company |\n\n#### Return\n\n\n[CompanyField](#) --- this company field, useful for chaining\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.google.com/m8/feeds`"]]