เลิกใช้งานแล้ว แต่ให้ใช้บริการขั้นสูงของ People API แทน
ฟิลด์การรับส่งข้อความโต้ตอบแบบทันทีในรายชื่อติดต่อ
เมธอด
วิธีการ | ประเภทการแสดงผล | รายละเอียดแบบย่อ |
---|---|---|
get | String | รับที่อยู่สำหรับฟิลด์นี้ |
get | Object | รับป้ายกำกับสำหรับฟิลด์นี้ |
is | Boolean | รับว่าค่าฟิลด์นี้เป็นค่าหลักหรือไม่ |
set |
| ตั้งค่าที่อยู่ของฟิลด์นี้ |
set |
| ตั้งค่าช่องนี้เป็นช่องหลัก |
set |
| ตั้งค่าป้ายกำกับของช่องนี้ |
set |
| ตั้งค่าป้ายกำกับของช่องนี้ |
เอกสารโดยละเอียด
get Address()
รับที่อยู่สำหรับฟิลด์นี้
// Logs the address for the 'Home Address' field for contact 'John Doe'. // Can be used similarly for other fields that contain addresses. const contacts = ContactsApp.getContactsByName('John Doe'); const homeAddress = contacts[0].getAddresses(ContactsApp.Field.HOME_ADDRESS); Logger.log(homeAddress[0].getAddress());
รีเทิร์น
String
— ที่อยู่เป็นสตริง
การให้สิทธิ์
สคริปต์ที่ใช้วิธีนี้ต้องมีการให้สิทธิ์ที่มีขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.google.com/m8/feeds
get Label()
รับป้ายกำกับสำหรับฟิลด์นี้ ซึ่งอาจเป็น Field, ExtendedField หรือ String
// 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
is Primary()
รับว่าค่าฟิลด์นี้เป็นค่าหลักหรือไม่
// 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
— whether this is primary
การให้สิทธิ์
สคริปต์ที่ใช้วิธีนี้ต้องมีการให้สิทธิ์ที่มีขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.google.com/m8/feeds
set Address(address)
ตั้งค่าที่อยู่ของฟิลด์นี้
// Sets the address for the 'Home Address' field for contact 'John Doe'. // Can be used similarly for other fields that contain addresses. const contacts = ContactsApp.getContactsByName('John Doe'); const homeAddress = contacts[0].getAddresses(ContactsApp.Field.HOME_ADDRESS); homeAddress[0].setAddress('123 Main St, Raleigh, NC, 27601');
พารามิเตอร์
ชื่อ | ประเภท | คำอธิบาย |
---|---|---|
address | String | ที่อยู่ใหม่ |
รีเทิร์น
— ฟิลด์นี้มีประโยชน์สำหรับการเชื่อมโยงIMField
การให้สิทธิ์
สคริปต์ที่ใช้วิธีนี้ต้องมีการให้สิทธิ์ที่มีขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.google.com/m8/feeds
set As Primary()
ตั้งค่าช่องนี้เป็นช่องหลัก
// 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 นี้สำหรับการเชื่อมโยงIMField
การให้สิทธิ์
สคริปต์ที่ใช้วิธีนี้ต้องมีการให้สิทธิ์ที่มีขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.google.com/m8/feeds
set Label(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 นี้สำหรับการเชื่อมโยงIMField
การให้สิทธิ์
สคริปต์ที่ใช้วิธีนี้ต้องมีการให้สิทธิ์ที่มีขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.google.com/m8/feeds
set Label(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 | ป้ายกำกับใหม่สำหรับช่องนี้ |
รีเทิร์น
— ฟิลด์นี้มีประโยชน์สำหรับการเชื่อมโยงIMField
การให้สิทธิ์
สคริปต์ที่ใช้วิธีนี้ต้องมีการให้สิทธิ์ที่มีขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.google.com/m8/feeds