Class PhoneField

Phone Field

Deprecated.Instead, use the People API advanced service

A phone number field in a Contact.

Methods

Method Return type Brief description
Object Gets the label for this field.
Boolean Gets whether this is the primary field value.
Phone Field Sets this field to primary.
Phone Field Sets the label of this field.
Phone Field Sets the label of this field.

Detailed documentation

get Label()

Gets the label for this field. This may be a Field, ExtendedField, or a 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. 
 const 
  
 contacts 
  
 = 
  
 ContactsApp 
 . 
 getContactsByName 
 ( 
 'John Doe' 
 ); 
 const 
  
 addressFields 
  
 = 
  
 contacts 
 [ 
 0 
 ]. 
 getAddresses 
 (); 
 for 
  
 ( 
 let 
  
 i 
  
 = 
  
 0 
 ; 
  
 i 
 < 
 addressFields 
 . 
 length 
 ; 
  
 i 
 ++ 
 ) 
  
 { 
  
 Logger 
 . 
 log 
 ( 
 addressFields 
 [ 
 i 
 ]. 
 getLabel 
 ()); 
 } 

Return

Object — the label for this field

Authorization

Scripts that use this method require authorization with one or more of the following scopes :

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

is Primary()

Gets whether this is the primary field value.

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

Return

Boolean — whether this is primary

Authorization

Scripts that use this method require authorization with one or more of the following scopes :

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

set As Primary()

Sets this field to primary.

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

Return

Phone Field — this FieldValue for chaining

Authorization

Scripts that use this method require authorization with one or more of the following scopes :

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

set Label(field)

Sets the label of this field.

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

Parameters

Name Type Description
field
Field the new standard label

Return

Phone Field — this FieldValue for chaining

Authorization

Scripts that use this method require authorization with one or more of the following scopes :

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

set Label(label)

Sets the label of this field.

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

Parameters

Name Type Description
label
String the new label for this field

Return

Phone Field — this field, useful for chaining

Authorization

Scripts that use this method require authorization with one or more of the following scopes :

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

Deprecated methods



Design a Mobile Site
View Site in Mobile | Classic
Share by: