Class EmailField

E-Mail-Feld

Veraltet. Verwenden Sie stattdessen den erweiterten Dienst der People API.

Ein E-Mail-Feld in einem Kontakt.

Methoden

MethodeRückgabetypKurzbeschreibung
getAddress()StringRufen Sie die Adresse für dieses Feld ab.
getLabel()ObjectRuft das Label für dieses Feld ab.
isPrimary()BooleanGibt an, ob dies der Wert des Hauptfelds ist.
setAddress(address)EmailFieldLegt die Adresse dieses Felds fest.
setAsPrimary()EmailFieldLegt dieses Feld als primär fest.
setLabel(field)EmailFieldLegt das Label dieses Felds fest.
setLabel(label)EmailFieldLegt das Label dieses Felds fest.
MethodeRückgabetypKurzbeschreibung
deleteEmailField()voidLöscht diese E-Mail-Adresse aus dem Kontakt.
getDisplayName()StringGibt den Anzeigenamen für diese E-Mail-Adresse zurück.
setDisplayName(name)EmailFieldLegt den Anzeigenamen für diese E-Mail-Adresse fest.

Detaillierte Dokumentation

getAddress()

Rufen Sie die Adresse für dieses Feld ab.

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

Rückflug

String: Adresse als String

Autorisierung

Scripts, die diese Methode verwenden, erfordern eine Autorisierung für einen oder mehrere der folgenden Bereiche:

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

getLabel()

Ruft das Label für dieses Feld ab. Dies kann ein Feld, ein erweitertes Feld oder ein String sein.

// 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());
}

Rückflug

Object – das Label für dieses Feld

Autorisierung

Scripts, die diese Methode verwenden, erfordern eine Autorisierung für einen oder mehrere der folgenden Bereiche:

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

isPrimary()

Gibt an, ob dies der Wert des Hauptfelds ist.

// 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.
const contacts = ContactsApp.getContactsByName('John Doe');
const addressFields = contacts[0].getAddresses();
Logger.log(addressFields[0].isPrimary());

Rückflug

Boolean – ob es sich um die primäre Adresse handelt

Autorisierung

Scripts, die diese Methode verwenden, erfordern eine Autorisierung für einen oder mehrere der folgenden Bereiche:

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

setAddress(address)

Legt die Adresse dieses Felds fest.

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

Parameter

NameTypBeschreibung
addressStringdie neue Adresse

Rückflug

EmailField – dieses Feld ist für die Verkettung nützlich

Autorisierung

Scripts, die diese Methode verwenden, erfordern eine Autorisierung für einen oder mehrere der folgenden Bereiche:

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

setAsPrimary()

Legt dieses Feld als primär fest.

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

Rückflug

EmailField – diese FieldValue für die Verkettung

Autorisierung

Scripts, die diese Methode verwenden, erfordern eine Autorisierung für einen oder mehrere der folgenden Bereiche:

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

setLabel(field)

Legt das Label dieses Felds fest.

// 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.
const contacts = ContactsApp.getContactsByName('John Doe');
const addressFields = contacts[0].getAddresses();
addressFields[0].setLabel(ContactsApp.Field.WORK_ADDRESS);

Parameter

NameTypBeschreibung
fieldFielddas neue Standardlabel

Rückflug

EmailField – diese FieldValue für die Verkettung

Autorisierung

Scripts, die diese Methode verwenden, erfordern eine Autorisierung für einen oder mehrere der folgenden Bereiche:

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

setLabel(label)

Legt das Label dieses Felds fest.

// 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');

Parameter

NameTypBeschreibung
labelStringdas neue Label für dieses Feld

Rückflug

EmailField – dieses Feld ist für die Verkettung nützlich

Autorisierung

Scripts, die diese Methode verwenden, erfordern eine Autorisierung für einen oder mehrere der folgenden Bereiche:

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

Eingestellte Methoden

Veraltet. Diese Funktion wurde eingestellt und sollte in neuen Scripts nicht verwendet werden.

Löscht diese E-Mail-Adresse aus dem Kontakt.

// Retrieves and deletes the work email address for contact 'John Doe'
const contacts = ContactsApp.getContactsByName('John Doe');
const workEmail = contacts[0].getEmails(ContactsApp.Field.WORK_EMAIL);
workEmail[0].deleteEmailField();

Autorisierung

Scripts, die diese Methode verwenden, erfordern eine Autorisierung für einen oder mehrere der folgenden Bereiche:

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

Veraltet. Diese Funktion wurde eingestellt und sollte in neuen Scripts nicht verwendet werden.

Gibt den Anzeigenamen für diese E-Mail-Adresse zurück.

// Logs the display name for the work email address for contact 'John Doe'
const contacts = ContactsApp.getContactsByName('John Doe');
const workEmail = contacts[0].getEmails(ContactsApp.Field.WORK_EMAIL);
Logger.log(workEmail[0].getDisplayName());

Rückflug

String: Der Anzeigename für diese E-Mail-Adresse.

Autorisierung

Scripts, die diese Methode verwenden, erfordern eine Autorisierung für einen oder mehrere der folgenden Bereiche:

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

Veraltet. Diese Funktion wurde eingestellt und sollte in neuen Scripts nicht verwendet werden.

Legt den Anzeigenamen für diese E-Mail-Adresse fest.

// Sets the display name to 'Doe, John' for the work email address for contact
// 'John Doe'
const contacts = ContactsApp.getContactsByName('John Doe');
const workEmail = contacts[0].getEmails(ContactsApp.Field.WORK_EMAIL);
workEmail[0].setDisplayName('Doe, John');

Parameter

NameTypBeschreibung
nameStringden neuen Anzeigenamen für diese E-Mail-Adresse

Rückflug

EmailField – dieses E-Mail-Feld, nützlich für die Verknüpfung

Autorisierung

Scripts, die diese Methode verwenden, erfordern eine Autorisierung für einen oder mehrere der folgenden Bereiche:

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