Class CustomField
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Szczegółowa dokumentacja
getLabel()
Pobiera etykietę tego pola. Może to być pole, rozszerzone pole lub ciąg znaków.
// Logs the label for all the address fields associated with contact
// 'John Doe'. This method can be similarly called for any field that has
// a label.
const contacts = ContactsApp.getContactsByName('John Doe');
const addressFields = contacts[0].getAddresses();
for (let i = 0; i < addressFields.length; i++) {
Logger.log(addressFields[i].getLabel());
}
Powrót
Object – etykieta tego pola
Autoryzacja
Skrypty, które korzystają z tej metody, wymagają autoryzacji z co najmniej jednym z tych zakresów:
-
https://www.google.com/m8/feeds
setLabel(label)
Ustawia etykietę tego pola.
// Sets the label to 'Apartment' for the first address field associated
// with contact 'John Doe'. This method can be similarly called for any
// field that has a label.
const contacts = ContactsApp.getContactsByName('John Doe');
const addressFields = contacts[0].getAddresses();
addressFields[0].setLabel('Apartment');
Parametry
| Nazwa | Typ | Opis |
label | String | nowa etykieta tego pola. |
Powrót
CustomField – to pole, 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
Wycofane metody
deleteCustomField()
Wycofany. Ta funkcja została wycofana i nie należy jej używać w nowych skryptach.
Usuwa to pole.
const contacts = ContactsApp.getContactsByName('John Doe');
const fields = contacts[0].getCustomFields();
for (let i = 0; i < fields.length; i++) {
if (fields[i].getLabel() === 'foo') {
fields[i].deleteCustomField();
}
}
Autoryzacja
Skrypty, które korzystają z tej metody, wymagają autoryzacji z co najmniej jednym z tych zakresów:
-
https://www.google.com/m8/feeds
getValue()
Wycofany. Ta funkcja została wycofana i nie należy jej używać w nowych skryptach.
Pobiera wartość pola.
// Logs the value of all the custom fields for contact 'John Doe'
const contacts = ContactsApp.getContactsByName('John Doe');
const fields = contacts[0].getCustomFields();
for (const i in fields) {
Logger.log(fields[i].getValue());
}
Powrót
Object – wartość zapisana w polu
Autoryzacja
Skrypty, które korzystają z tej metody, wymagają autoryzacji z co najmniej jednym z tych zakresów:
-
https://www.google.com/m8/feeds
setLabel(field)
Wycofany. Ta funkcja została wycofana i nie należy jej używać w nowych skryptach.
Ustawia etykietę tego pola.
// Sets the first custom field associated with contact 'John Doe' to use 'Mail
// application' as a label, with 'Gmail' as the value.
const contacts = ContactsApp.getContactsByName('John Doe');
const field = contacts[0].getCustomFields()[0];
field.setLabel('Mail application');
field.setValue('Gmail');
Parametry
Powrót
CustomField – to pole, 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
setValue(value)
Wycofany. Ta funkcja została wycofana i nie należy jej używać w nowych skryptach.
Ustawia wartość tego pola.
// Sets the first custom field associated with contact 'John Doe' to use 'Mail
// application' as a label, with 'Gmail' as the value.
const contacts = ContactsApp.getContactsByName('John Doe');
const field = contacts[0].getCustomFields()[0];
field.setLabel('Mail application');
field.setValue('Gmail');
Parametry
| Nazwa | Typ | Opis |
value | Object | nowa wartość |
Powrót
CustomField – to pole, 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."],[],["The `CustomField` in the Contacts API is deprecated in favor of the People API. It allows interacting with a custom field in a contact, using `getLabel()` to retrieve the field's label and `setLabel(label)` to change it. Deprecated methods include `deleteCustomField()` to remove the field, `getValue()` to get the field's value, `setLabel(field)` to set a label, and `setValue(value)` to assign the field's value. These actions require specific authorization scopes.\n"]]