เลิกใช้งานแล้ว แต่ให้ใช้บริการขั้นสูงของ People API แทน
ช่องหมายเลขโทรศัพท์ในรายชื่อติดต่อ
เมธอด
วิธีการ | ประเภทการแสดงผล | รายละเอียดแบบย่อ |
---|---|---|
get | Object | รับป้ายกำกับของช่องนี้ |
is | Boolean | รับว่านี่เป็นค่าช่องหลักหรือไม่ |
set |
| ตั้งค่าช่องนี้เป็นค่าหลัก |
set |
| ตั้งค่าป้ายกํากับของช่องนี้ |
set |
| ตั้งค่าป้ายกํากับของช่องนี้ |
วิธีการที่เลิกใช้งาน
วิธีการ | ประเภทการแสดงผล | รายละเอียดแบบย่อ |
---|---|---|
| void | ลบฟิลด์หมายเลขโทรศัพท์นี้ |
| String | รับหมายเลขโทรศัพท์สำหรับช่องนี้ |
|
| ตั้งค่าหมายเลขโทรศัพท์สำหรับช่องนี้ |
เอกสารประกอบโดยละเอียด
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
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. const contacts = ContactsApp.getContactsByName('John Doe'); const addressFields = contacts[0].getAddresses(); Logger.log(addressFields[0].isPrimary());
รีเทิร์น
Boolean
— ระบุว่าเป็นภาษาหลักหรือไม่
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.google.com/m8/feeds
setAsPrimary()
ตั้งค่าช่องนี้เป็นค่าหลัก
// 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();
รีเทิร์น
— FieldValue นี้สําหรับการต่อเชื่อมPhone
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 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. const contacts = ContactsApp.getContactsByName('John Doe'); const addressFields = contacts[0].getAddresses(); addressFields[0].setLabel(ContactsApp.Field.WORK_ADDRESS);
พารามิเตอร์
ชื่อ | ประเภท | คำอธิบาย |
---|---|---|
field |
| ป้ายกำกับมาตรฐานใหม่ |
รีเทิร์น
— FieldValue นี้สําหรับการต่อเชื่อมPhone
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 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 | ป้ายกำกับใหม่สำหรับช่องนี้ |
รีเทิร์น
— ช่องนี้มีประโยชน์สำหรับการต่อเชื่อมPhone
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.google.com/m8/feeds
วิธีการที่เลิกใช้งาน
deletePhoneField()
deletePhoneField()
เลิกใช้งานแล้ว ฟังก์ชันนี้เลิกใช้งานแล้วและไม่ควรนำมาใช้ในสคริปต์ใหม่
ลบฟิลด์หมายเลขโทรศัพท์นี้
// Retrieves and deletes the work phone number field for contact 'John // Doe' const contacts = ContactsApp.getContactsByName('John Doe'); const phoneFields = contacts[0].getPhones(ContactsApp.Field.WORK_PHONE); phoneFields[0].deletePhoneField();
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.google.com/m8/feeds
getPhoneNumber()
getPhoneNumber()
เลิกใช้งานแล้ว ฟังก์ชันนี้เลิกใช้งานแล้วและไม่ควรนำมาใช้ในสคริปต์ใหม่
รับหมายเลขโทรศัพท์สำหรับช่องนี้
// Logs the work phone number for contact 'John Doe' const contacts = ContactsApp.getContactsByName('John Doe'); const phoneFields = contacts[0].getPhones(ContactsApp.Field.WORK_PHONE); Logger.log(phoneFields[0].getPhoneNumber());
รีเทิร์น
String
— ตัวเลขเป็นสตริง
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.google.com/m8/feeds
setPhoneNumber(number)
setPhoneNumber(number)
เลิกใช้งานแล้ว ฟังก์ชันนี้เลิกใช้งานแล้วและไม่ควรนำมาใช้ในสคริปต์ใหม่
ตั้งค่าหมายเลขโทรศัพท์สำหรับช่องนี้
// Sets the work phone number for contact 'John Doe' const contacts = ContactsApp.getContactsByName('John Doe'); const phoneFields = contacts[0].getPhones(ContactsApp.Field.WORK_PHONE); phoneFields[0].setPhoneNumber('212-555-1234');
พารามิเตอร์
ชื่อ | ประเภท | คำอธิบาย |
---|---|---|
number | String | หมายเลขใหม่ |
รีเทิร์น
— ช่องนี้มีประโยชน์สำหรับการต่อเชื่อมPhone
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.google.com/m8/feeds