Class EmailField

EmailField

Wycofano. Zamiast tego użyj zaawansowanej usługi People API

Pole adresu e-mail w Kontaktu.

Metody

MetodaZwracany typKrótki opis
getAddress()StringUzyskaj adres tego pola.
getLabel()ObjectPobiera etykietę tego pola.
isPrimary()BooleanSprawdza, czy jest to wartość pola podstawowego.
setAddress(address)EmailFieldUstawia adres tego pola.
setAsPrimary()EmailFieldUstawia to pole jako „podstawowe”.
setLabel(field)EmailFieldUstawia etykietę tego pola.
setLabel(label)EmailFieldUstawia etykietę tego pola.

Szczegółowa dokumentacja

getAddress()

Uzyskaj adres tego pola.

// Logs the address for the 'Home Address' field for contact 'John Doe'.
// Can be used similarly for other fields that contain addresses.
var contacts = ContactsApp.getContactsByName('John Doe');
var homeAddress = contacts[0].getAddresses(ContactsApp.Field.HOME_ADDRESS);
Logger.log(homeAddress[0].getAddress());

Powroty

String – adres w postaci ciągu znaków,

Upoważnienie

Skrypty korzystające z tej metody wymagają autoryzacji z co najmniej jednym z tych zakresów:

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

getLabel()

Pobiera etykietę tego pola. Może to być Pole, ExtendedField lub String.

// 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.
var contacts = ContactsApp.getContactsByName('John Doe');
var addressFields = contacts[0].getAddresses();
for (var i = 0; i < addressFields.length; i++) {
  Logger.log(addressFields[i].getLabel());
}

Powroty

Object – etykieta danego pola,

Upoważnienie

Skrypty korzystające z tej metody wymagają autoryzacji z co najmniej jednym z tych zakresów:

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

isPrimary()

Sprawdza, czy jest to wartość pola podstawowego.

// Logs whether or not the first address field associated with contact
// 'John Doe' is labeled as primary. This method can be similarly called
// for any field.
var contacts = ContactsApp.getContactsByName('John Doe');
var addressFields = contacts[0].getAddresses();
Logger.log(addressFields[0].isPrimary());

Powroty

Boolean – czy jest to miejsce podstawowe.

Upoważnienie

Skrypty korzystające z tej metody wymagają autoryzacji z co najmniej jednym z tych zakresów:

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

setAddress(address)

Ustawia adres tego pola.

// Sets the address for the 'Home Address' field for contact 'John Doe'.
// Can be used similarly for other fields that contain addresses.
var contacts = ContactsApp.getContactsByName('John Doe');
var homeAddress = contacts[0].getAddresses(ContactsApp.Field.HOME_ADDRESS);
homeAddress[0].setAddress('123 Main St, Raleigh, NC, 27601');

Parametry

NazwaTypOpis
addressStringnowy adres

Powroty

EmailField – to pole przydatne przy tworzeniu łańcuchów

Upoważnienie

Skrypty korzystające z tej metody wymagają autoryzacji z co najmniej jednym z tych zakresów:

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

setAsPrimary()

Ustawia to pole jako „podstawowe”.

// Sets the the first address field associated with contact 'John Doe'
// as primary. This method can be similarly called for any field.
var contacts = ContactsApp.getContactsByName('John Doe');
var addressFields = contacts[0].getAddresses();
addressFields[0].setAsPrimary();

Powroty

EmailField – ta wartość FieldValue na potrzeby łańcuchów

Upoważnienie

Skrypty korzystające z tej metody wymagają autoryzacji z co najmniej jednym z tych zakresów:

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

setLabel(field)

Ustawia etykietę tego pola.

// Sets the label to 'Work' for the first address field associated
// with contact 'John Doe'. This method can be similarly called for any
// field that has a label.
var contacts = ContactsApp.getContactsByName('John Doe');
var addressFields = contacts[0].getAddresses();
addressFields[0].setLabel(ContactsApp.Field.WORK_ADDRESS);

Parametry

NazwaTypOpis
fieldFieldnowa etykieta standardowa

Powroty

EmailField – ta wartość FieldValue na potrzeby łańcuchów

Upoważnienie

Skrypty korzystające 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.
var contacts = ContactsApp.getContactsByName('John Doe');
var addressFields = contacts[0].getAddresses();
addressFields[0].setLabel('Apartment');

Parametry

NazwaTypOpis
labelStringnowa etykieta tego pola

Powroty

EmailField – to pole przydatne przy tworzeniu łańcuchów

Upoważnienie

Skrypty korzystające z tej metody wymagają autoryzacji z co najmniej jednym z tych zakresów:

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

Wycofane metody