Class UrlField

UrlField

Obsolète. Utilisez plutôt le service avancé de l'API People.

Champ d'URL dans un contact.

Méthodes

MéthodeType renvoyéBrève description
getAddress()StringObtenez l'adresse de ce champ.
getLabel()ObjectRécupère le libellé de ce champ.
isPrimary()BooleanDétermine s'il s'agit de la valeur du champ principal.
setAddress(address)UrlFieldDéfinit l'adresse de ce champ.
setAsPrimary()UrlFieldDéfinit ce champ sur "Principal".
setLabel(field)UrlFieldDéfinit le libellé de ce champ.
setLabel(label)UrlFieldDéfinit le libellé de ce champ.

Documentation détaillée

getAddress()

Obtenez l'adresse de ce champ.

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

Renvois

String : adresse sous forme de chaîne

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à un ou plusieurs des champs d'application suivants:

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

getLabel()

Récupère le libellé de ce champ. Il peut s'agir d'un champ, d'un champ ExtendedField ou d'une chaîne.

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

Renvois

Object : libellé de ce champ

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à un ou plusieurs des champs d'application suivants:

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

isPrimary()

Détermine s'il s'agit de la valeur du champ principal.

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

Renvois

Boolean : indique s'il s'agit de la version principale

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à un ou plusieurs des champs d'application suivants:

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

setAddress(address)

Définit l'adresse de ce champ.

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

Paramètres

NomTypeDescription
addressStringla nouvelle adresse

Renvois

UrlField : champ utile pour les chaînes

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à un ou plusieurs des champs d'application suivants:

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

setAsPrimary()

Définit ce champ sur "Principal".

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

Renvois

UrlField : cette valeur FieldValue pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à un ou plusieurs des champs d'application suivants:

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

setLabel(field)

Définit le libellé de ce champ.

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

Paramètres

NomTypeDescription
fieldFieldle nouveau libellé standard

Renvois

UrlField : cette valeur FieldValue pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à un ou plusieurs des champs d'application suivants:

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

setLabel(label)

Définit le libellé de ce champ.

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

Paramètres

NomTypeDescription
labelStringle nouveau libellé de ce champ

Renvois

UrlField : champ utile pour les chaînes

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à un ou plusieurs des champs d'application suivants:

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

Méthodes obsolètes