บริการ Gmail ขั้นสูงช่วยให้คุณใช้ Gmail API ใน Apps Script ซึ่งคล้ายกับบริการ Gmail ในตัวของ Apps Script API นี้จะอนุญาตให้สคริปต์ค้นหาและแก้ไขชุดข้อความ ข้อความ และป้ายกำกับใน กล่องจดหมาย Gmail ในกรณีส่วนใหญ่ บริการในตัวจะใช้งานง่ายกว่า แต่ บริการขั้นสูงจะมีคุณลักษณะเพิ่มเติมเล็กน้อยและสามารถเข้าถึง เกี่ยวกับเนื้อหา Gmail
ข้อมูลอ้างอิง
สำหรับข้อมูลโดยละเอียดเกี่ยวกับบริการนี้ โปรดดูที่ เอกสารอ้างอิงสำหรับ Gmail API เช่นเดียวกับบริการขั้นสูงทั้งหมดใน Apps Script บริการ Gmail ขั้นสูงจะใช้ ออบเจ็กต์ เมธอด และพารามิเตอร์เดียวกันกับ API สาธารณะ ดูข้อมูลเพิ่มเติมได้ที่วิธีกำหนดลายเซ็นของเมธอด
หากต้องการรายงานปัญหาและค้นหาการสนับสนุนอื่นๆ โปรดดู คู่มือการสนับสนุนของ Gmail
โค้ดตัวอย่าง
โค้ดตัวอย่างด้านล่างใช้ API เวอร์ชัน 1
แสดงรายการข้อมูลป้ายกำกับ
ตัวอย่างต่อไปนี้แสดงวิธีแสดงข้อมูลป้ายกำกับทั้งหมดของผู้ใช้ ซึ่งรวมถึงชื่อป้ายกำกับ ประเภท รหัส และการตั้งค่าระดับการเข้าถึง
แสดงรายการข้อมูลโค้ดกล่องจดหมาย
ตัวอย่างต่อไปนี้แสดงวิธีแสดงรายการตัวอย่างข้อความที่เชื่อมโยงกับ แต่ละชุดข้อความในกล่องจดหมายของผู้ใช้ โปรดสังเกตการใช้โทเค็นของหน้าเว็บเพื่อเข้าถึง รายการผลการค้นหาทั้งหมด
แสดงรายการประวัติการเข้าชมล่าสุด
ตัวอย่างต่อไปนี้แสดงวิธีบันทึกประวัติกิจกรรมล่าสุด โดยเฉพาะอย่างยิ่ง ตัวอย่างนี้จะกู้คืนรหัสระเบียนประวัติที่เชื่อมโยงกับ ข้อความที่ส่งล่าสุดของผู้ใช้ จากนั้นจะบันทึกรหัสข้อความของ ข้อความที่เปลี่ยนไปนับจากเวลานั้น ข้อความที่เปลี่ยนแปลงแต่ละรายการจะได้รับการบันทึกเท่านั้น เพียงครั้งเดียว ไม่ว่าจะมีเหตุการณ์การเปลี่ยนแปลงกี่รายการในบันทึกประวัติ โปรดสังเกต ใช้โทเค็นของหน้าเว็บเพื่อเข้าถึงรายการผลลัพธ์ทั้งหมด