Class PhoneField

PhoneField

Không dùng nữa. Thay vào đó, hãy dùng API Người dùng nâng cao dịch vụ

Trường số điện thoại trong Người liên hệ.

Phương thức

Phương thứcLoại dữ liệu trả vềMô tả ngắn
getLabel()ObjectLấy nhãn cho trường này.
isPrimary()BooleanLấy xem đây có phải là giá trị chính của trường hay không.
setAsPrimary()PhoneFieldĐặt trường này thành trường chính.
setLabel(field)PhoneFieldĐặt nhãn cho trường này.
setLabel(label)PhoneFieldĐặt nhãn cho trường này.

Tài liệu chi tiết

getLabel()

Lấy nhãn cho trường này. Đây có thể là Trường, ExtendedField hoặc Chuỗi.

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

Cầu thủ trả bóng

Object — nhãn cho trường này

Ủy quyền

Tập lệnh sử dụng phương thức này yêu cầu ủy quyền với một hoặc nhiều phạm vi sau:

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

isPrimary()

Lấy xem đây có phải là giá trị chính của trường hay không.

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

Cầu thủ trả bóng

Boolean — đây có phải là danh sách chính hay không

Ủy quyền

Tập lệnh sử dụng phương thức này yêu cầu ủy quyền với một hoặc nhiều phạm vi sau:

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

setAsPrimary()

Đặt trường này thành trường chính.

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

Cầu thủ trả bóng

PhoneField — trường này dùng để tạo chuỗi

Ủy quyền

Tập lệnh sử dụng phương thức này yêu cầu ủy quyền với một hoặc nhiều phạm vi sau:

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

setLabel(field)

Đặt nhãn cho trường này.

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

Tham số

TênLoạiMô tả
fieldFieldnhãn tiêu chuẩn mới

Cầu thủ trả bóng

PhoneField — trường này dùng để tạo chuỗi

Ủy quyền

Tập lệnh sử dụng phương thức này yêu cầu ủy quyền với một hoặc nhiều phạm vi sau:

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

setLabel(label)

Đặt nhãn cho trường này.

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

Tham số

TênLoạiMô tả
labelStringnhãn mới cho trường này

Cầu thủ trả bóng

PhoneField – trường này, hữu ích cho việc tạo chuỗi

Ủy quyền

Tập lệnh sử dụng phương thức này yêu cầu ủy quyền với một hoặc nhiều phạm vi sau:

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

Các phương thức ngừng hoạt động