Class CustomField
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: 2024-12-22 UTC.
[null,null,["Ostatnia aktualizacja: 2024-12-22 UTC."],[[["`CustomField` is deprecated and the People API advanced service should be used instead."],["It represents a custom field within a Contact and previously allowed for getting, setting, and deleting custom field data."],["`getLabel()` and `setLabel(label)` methods remain available for retrieving and setting the label of a custom field."],["Several methods, including `deleteCustomField()`, `getValue()`, `setLabel(field)`, and `setValue(value)`, are deprecated and should no longer be used."]]],[]]