Obsolète. Utilisez plutôt le service avancé de l'API People.
Champ d'URL dans un contact.
Méthodes
Méthode | Type renvoyé | Brève description |
---|---|---|
get | String | Obtenez l'adresse pour ce champ. |
get | Object | Récupère le libellé de ce champ. |
is | Boolean | Indique si cette valeur est la valeur du champ principal. |
set |
| Définit l'adresse de ce champ. |
set |
| Définit ce champ sur "principal". |
set |
| Définit le libellé de ce champ. |
set |
| Définit le libellé de ce champ. |
Documentation détaillée
get Address()
Obtenez l'adresse pour ce champ.
// 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());
Renvois
String
: adresse sous forme de chaîne
Autorisation
Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants:
-
https://www.google.com/m8/feeds
get Label()
Récupère le libellé de ce champ. Il peut s'agir d'un champ, d'un champ étendu 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. const contacts = ContactsApp.getContactsByName('John Doe'); const addressFields = contacts[0].getAddresses(); for (let 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 avec un ou plusieurs des champs d'application suivants:
-
https://www.google.com/m8/feeds
is Primary()
Indique si cette valeur est 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. const contacts = ContactsApp.getContactsByName('John Doe'); const addressFields = contacts[0].getAddresses(); Logger.log(addressFields[0].isPrimary());
Renvois
Boolean
: indique si l'élément est principal
Autorisation
Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants:
-
https://www.google.com/m8/feeds
set Address(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. const contacts = ContactsApp.getContactsByName('John Doe'); const homeAddress = contacts[0].getAddresses(ContactsApp.Field.HOME_ADDRESS); homeAddress[0].setAddress('123 Main St, Raleigh, NC, 27601');
Paramètres
Nom | Type | Description |
---|---|---|
address | String | la nouvelle adresse ; |
Renvois
: champ utile pour le chaînageUrl
Autorisation
Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants:
-
https://www.google.com/m8/feeds
set As Primary()
Définit ce champ sur "principal".
// 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();
Renvois
: cette FieldValue pour le chaînageUrl
Autorisation
Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants:
-
https://www.google.com/m8/feeds
set Label(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. const contacts = ContactsApp.getContactsByName('John Doe'); const addressFields = contacts[0].getAddresses(); addressFields[0].setLabel(ContactsApp.Field.WORK_ADDRESS);
Paramètres
Nom | Type | Description |
---|---|---|
field |
| le nouveau libellé standard |
Renvois
: cette FieldValue pour le chaînageUrl
Autorisation
Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants:
-
https://www.google.com/m8/feeds
set Label(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. const contacts = ContactsApp.getContactsByName('John Doe'); const addressFields = contacts[0].getAddresses(); addressFields[0].setLabel('Apartment');
Paramètres
Nom | Type | Description |
---|---|---|
label | String | le nouveau libellé de ce champ |
Renvois
: champ utile pour le chaînageUrl
Autorisation
Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants:
-
https://www.google.com/m8/feeds