เลิกใช้งานแล้ว แต่ให้ใช้บริการขั้นสูงของ People API แทน
ช่องที่กำหนดเองในรายชื่อติดต่อ
เมธอด
วิธีการ | ประเภทการแสดงผล | รายละเอียดแบบย่อ |
---|---|---|
get | Object | รับป้ายกำกับของช่องนี้ |
set |
| ตั้งค่าป้ายกํากับของช่องนี้ |
วิธีการที่เลิกใช้งาน
วิธีการ | ประเภทการแสดงผล | รายละเอียดแบบย่อ |
---|---|---|
| void | ลบช่องนี้ |
| Object | รับค่าของช่อง |
|
| ตั้งค่าป้ายกํากับของช่องนี้ |
|
| ตั้งค่าของช่องนี้ |
เอกสารประกอบโดยละเอียด
getLabel()
รับป้ายกำกับของช่องนี้ ซึ่งอาจเป็นฟิลด์ ExtendedField หรือสตริง
// 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()); }
รีเทิร์น
Object
— ป้ายกำกับของช่องนี้
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 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. const contacts = ContactsApp.getContactsByName('John Doe'); const addressFields = contacts[0].getAddresses(); addressFields[0].setLabel('Apartment');
พารามิเตอร์
ชื่อ | ประเภท | คำอธิบาย |
---|---|---|
label | String | ป้ายกำกับใหม่สำหรับช่องนี้ |
รีเทิร์น
— ช่องนี้มีประโยชน์สำหรับการต่อเชื่อมCustom
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.google.com/m8/feeds
วิธีการที่เลิกใช้งาน
deleteCustomField()
deleteCustomField()
เลิกใช้งานแล้ว ฟังก์ชันนี้เลิกใช้งานแล้วและไม่ควรนำมาใช้ในสคริปต์ใหม่
ลบช่องนี้
const contacts = ContactsApp.getContactsByName('John Doe'); const fields = contacts[0].getCustomFields(); for (let i = 0; i < fields.length; i++) { if (fields[i].getLabel() === 'foo') { fields[i].deleteCustomField(); } }
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.google.com/m8/feeds
getValue()
getValue()
เลิกใช้งานแล้ว ฟังก์ชันนี้เลิกใช้งานแล้วและไม่ควรนำมาใช้ในสคริปต์ใหม่
รับค่าของช่อง
// Logs the value of all the custom fields for contact 'John Doe' const contacts = ContactsApp.getContactsByName('John Doe'); const fields = contacts[0].getCustomFields(); for (const i in fields) { Logger.log(fields[i].getValue()); }
รีเทิร์น
Object
— ค่าที่จัดเก็บในช่อง
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.google.com/m8/feeds
setLabel(field)
setLabel(field)
เลิกใช้งานแล้ว ฟังก์ชันนี้เลิกใช้งานแล้วและไม่ควรนำมาใช้ในสคริปต์ใหม่
ตั้งค่าป้ายกํากับของช่องนี้
// Sets the first custom field associated with contact 'John Doe' to use 'Mail // application' as a label, with 'Gmail' as the value. const contacts = ContactsApp.getContactsByName('John Doe'); const field = contacts[0].getCustomFields()[0]; field.setLabel('Mail application'); field.setValue('Gmail');
พารามิเตอร์
ชื่อ | ประเภท | คำอธิบาย |
---|---|---|
field |
| ป้ายกำกับมาตรฐานใหม่ |
รีเทิร์น
— ช่องนี้มีประโยชน์สำหรับการต่อเชื่อมCustom
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.google.com/m8/feeds
setValue(value)
setValue(value)
เลิกใช้งานแล้ว ฟังก์ชันนี้เลิกใช้งานแล้วและไม่ควรนำมาใช้ในสคริปต์ใหม่
ตั้งค่าของช่องนี้
// Sets the first custom field associated with contact 'John Doe' to use 'Mail // application' as a label, with 'Gmail' as the value. const contacts = ContactsApp.getContactsByName('John Doe'); const field = contacts[0].getCustomFields()[0]; field.setLabel('Mail application'); field.setValue('Gmail');
พารามิเตอร์
ชื่อ | ประเภท | คำอธิบาย |
---|---|---|
value | Object | ค่าใหม่ |
รีเทิร์น
— ช่องนี้มีประโยชน์สำหรับการต่อเชื่อมCustom
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.google.com/m8/feeds