Class PhoneField

PhoneField

非推奨。代わりに、People API 拡張サービスを使用してください。

連絡先の電話番号フィールド。

Methods

メソッド戻り値の型概要
getLabel()Objectこのフィールドのラベルを取得します。
isPrimary()Booleanこれがプライマリ フィールド値かどうかを取得します。
setAsPrimary()PhoneFieldこのフィールドをメインに設定します。
setLabel(field)PhoneFieldこのフィールドのラベルを設定します。
setLabel(label)PhoneFieldこのフィールドのラベルを設定します。

詳細なドキュメント

getLabel()

このフィールドのラベルを取得します。Field、ExtendedField、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());
}

リターン

Object - このフィールドのラベル

承認

この方法を使用するスクリプトには、次の 1 つ以上のスコープによる承認が必要です。

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

isPrimary()

これがプライマリ フィールド値かどうかを取得します。

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

リターン

Boolean - プライマリかどうか

承認

この方法を使用するスクリプトには、次の 1 つ以上のスコープによる承認が必要です。

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

setAsPrimary()

このフィールドをプライマリに設定します。

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

リターン

PhoneField - チェーン用のこの FieldValue

承認

この方法を使用するスクリプトには、次の 1 つ以上のスコープによる承認が必要です。

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

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

パラメータ

名前説明
fieldField新しい標準ラベルを

リターン

PhoneField - チェーン用のこの FieldValue

承認

この方法を使用するスクリプトには、次の 1 つ以上のスコープによる承認が必要です。

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

setLabel(label)

このフィールドのラベルを設定します。

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

パラメータ

名前説明
labelStringこのフィールドの新しいラベル

リターン

PhoneField - このフィールド。チェーン化に役立ちます。

承認

この方法を使用するスクリプトには、次の 1 つ以上のスコープによる承認が必要です。

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

サポート終了のメソッド