Class PhoneField

Trường Điện thoại

Không dùng nữa. Thay vào đó, hãy sử dụng dịch vụ nâng cao của API People

Trường số điện thoại trong một 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()BooleanXác định xem đây có phải là giá trị trường chính hay không.
setAsPrimary()PhoneFieldĐặt trường này thành chính.
setLabel(field)PhoneFieldĐặt nhãn của trường này.
setLabel(label)PhoneFieldĐặt nhãn của 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.
const contacts = ContactsApp.getContactsByName('John Doe');
const addressFields = contacts[0].getAddresses();
for (let 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

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

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

isPrimary()

Xác định xem đây có phải là giá trị trường chính 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.
const contacts = ContactsApp.getContactsByName('John Doe');
const addressFields = contacts[0].getAddresses();
Logger.log(addressFields[0].isPrimary());

Cầu thủ trả bóng

Boolean – liệu đây có phải là phương thức chính không

Ủy quyền

Các tập lệnh sử dụng phương thức này yêu cầu được uỷ 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 chính.

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

Cầu thủ trả bóng

PhoneField – FieldValue này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này yêu cầu được uỷ 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 của 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.
const contacts = ContactsApp.getContactsByName('John Doe');
const 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 – FieldValue này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này yêu cầu được uỷ 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 của 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.
const contacts = ContactsApp.getContactsByName('John Doe');
const 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

Các tập lệnh sử dụng phương thức này yêu cầu được uỷ 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