Class CompanyField
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Wycofane metody
deleteCompanyField()
Wycofany. Ta funkcja została wycofana i nie należy jej używać w nowych skryptach.
Usuwa to pole firmy.
// Deletes the first company associated with contact 'John Doe'
const contacts = ContactsApp.getContactsByName('John Doe');
const company = contacts[0].getCompanies()[0];
company.deleteCompanyField();
Autoryzacja
Skrypty, które korzystają z tej metody, wymagają autoryzacji z co najmniej jednym z tych zakresów:
-
https://www.google.com/m8/feeds
getCompanyName()
Wycofany. Ta funkcja została wycofana i nie należy jej używać w nowych skryptach.
Pobiera nazwę firmy.
// 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());
}
Powrót
String
– nazwa firmy
Autoryzacja
Skrypty, które korzystają z tej metody, wymagają autoryzacji z co najmniej jednym z tych zakresów:
-
https://www.google.com/m8/feeds
getJobTitle()
Wycofany. Ta funkcja została wycofana i nie należy jej używać w nowych skryptach.
Pobiera nazwę stanowiska.
// 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());
}
Powrót
String
– stanowisko
Autoryzacja
Skrypty, które korzystają z tej metody, wymagają autoryzacji z co najmniej jednym z tych zakresów:
-
https://www.google.com/m8/feeds
isPrimary()
Wycofany. Ta funkcja została wycofana i nie należy jej używać w nowych skryptach.
Określa, czy jest to firma główna.
// 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());
}
Powrót
Boolean
– czy jest to element główny
Autoryzacja
Skrypty, które korzystają z tej metody, wymagają autoryzacji z co najmniej jednym z tych zakresów:
-
https://www.google.com/m8/feeds
setAsPrimary()
Wycofany. Ta funkcja została wycofana i nie należy jej używać w nowych skryptach.
Ustawia tę firmę jako firmę główną i odznacza firmę, która była wcześniej główną.
// 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();
Powrót
CompanyField
– to pole firmy, przydatne do łańcuchowania
Autoryzacja
Skrypty, które korzystają z tej metody, wymagają autoryzacji z co najmniej jednym z tych zakresów:
-
https://www.google.com/m8/feeds
setCompanyName(company)
Wycofany. Ta funkcja została wycofana i nie należy jej używać w nowych skryptach.
Ustawia nazwę firmy.
// 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');
Parametry
Nazwa | Typ | Opis |
company | String | nowa nazwa firmy, |
Powrót
CompanyField
– to pole firmy, przydatne do łańcuchowania
Autoryzacja
Skrypty, które korzystają z tej metody, wymagają autoryzacji z co najmniej jednym z tych zakresów:
-
https://www.google.com/m8/feeds
setJobTitle(title)
Wycofany. Ta funkcja została wycofana i nie należy jej używać w nowych skryptach.
Ustawia nazwę stanowiska.
// 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');
Parametry
Nazwa | Typ | Opis |
title | String | nowa nazwa stanowiska osoby kontaktowej w tej firmie |
Powrót
CompanyField
– to pole firmy, przydatne do łańcuchowania
Autoryzacja
Skrypty, które korzystają z tej metody, wymagają autoryzacji z co najmniej jednym z tych zakresów:
-
https://www.google.com/m8/feeds
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-26 UTC.
[null,null,["Ostatnia aktualizacja: 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`"]]