Class EmailField

EmailField

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

Trường email trong một Danh bạ.

Phương thức

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

Tài liệu chi tiết

getAddress()

Lấy địa chỉ cho trường này.

// Logs the address for the 'Home Address' field for contact 'John Doe'.
// Can be used similarly for other fields that contain addresses.
var contacts = ContactsApp.getContactsByName('John Doe');
var homeAddress = contacts[0].getAddresses(ContactsApp.Field.HOME_ADDRESS);
Logger.log(homeAddress[0].getAddress());

Cầu thủ trả bóng

String – địa chỉ dưới dạng chuỗi

Ủy quyền

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

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

getLabel()

Lấy nhãn cho trường này. Đây có thể là một Trường, ExtendedField hoặc một 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 của trường này

Ủy quyền

Tập lệnh sử dụng phương thức này cần được uỷ 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ị của 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.
var contacts = ContactsApp.getContactsByName('John Doe');
var addressFields = contacts[0].getAddresses();
Logger.log(addressFields[0].isPrimary());

Cầu thủ trả bóng

Boolean — cho dù đây là địa điểm chính

Ủy quyền

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

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

setAddress(address)

Đặt địa chỉ của trường này.

// Sets the address for the 'Home Address' field for contact 'John Doe'.
// Can be used similarly for other fields that contain addresses.
var contacts = ContactsApp.getContactsByName('John Doe');
var homeAddress = contacts[0].getAddresses(ContactsApp.Field.HOME_ADDRESS);
homeAddress[0].setAddress('123 Main St, Raleigh, NC, 27601');

Các tham số

TênLoạiNội dung mô tả
addressStringđịa chỉ mới

Cầu thủ trả bóng

EmailField — 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 cần đượ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 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

EmailField — FieldValue này để tạo chuỗi

Ủy quyền

Tập lệnh sử dụng phương thức này cần đượ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 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);

Các tham số

TênLoạiNội dung mô tả
fieldFieldnhãn chuẩn mới

Cầu thủ trả bóng

EmailField — FieldValue này để tạo chuỗi

Ủy quyền

Tập lệnh sử dụng phương thức này cần đượ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 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');

Các tham số

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

Cầu thủ trả bóng

EmailField — 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 cần đượ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