บริการการตั้งค่ากลุ่ม SDK ผู้ดูแลระบบ

บริการการตั้งค่ากลุ่ม SDK ผู้ดูแลระบบอนุญาตให้คุณใช้ Groups Settings API ของ Admin SDK ใน Apps Script ได้ โดย API นี้จะช่วยให้ผู้ดูแลระบบของ Google Workspace โดเมน (รวมถึงตัวแทนจำหน่าย) จัดการการตั้งค่ากลุ่มสำหรับกลุ่มใน Google Workspace บัญชีของตนได้

ข้อมูลอ้างอิง

หากต้องการข้อมูลโดยละเอียดเกี่ยวกับบริการนี้ โปรดดูเอกสารอ้างอิงสำหรับ Admin SDK Groups Settings API บริการการตั้งค่ากลุ่ม SDK ผู้ดูแลระบบจะใช้ออบเจ็กต์ เมธอด และพารามิเตอร์เดียวกันกับ API สาธารณะ เช่นเดียวกับบริการขั้นสูงทั้งหมดใน Apps Script โปรดดูข้อมูลเพิ่มเติมที่หัวข้อวิธีกำหนดลายเซ็นของเมธอด

หากต้องการรายงานปัญหาและค้นหาการสนับสนุนอื่นๆ โปรดดูคู่มือการสนับสนุนการตั้งค่ากลุ่ม SDK ผู้ดูแลระบบ

รหัสตัวอย่าง

โค้ดตัวอย่างด้านล่างใช้ API เวอร์ชัน 1

รับการตั้งค่าของกลุ่ม

โดยตัวอย่างนี้จะได้รับการตั้งค่าของกลุ่มและบันทึกลงในคอนโซล

advanced/adminSDK.gs
/**
 * Gets a group's settings and logs them to the console.
 */
function getGroupSettings() {
  // TODO (developer) - Replace groupId value with yours
  const groupId = 'exampleGroup@example.com';
  try {
    const group = AdminGroupsSettings.Groups.get(groupId);
    console.log(JSON.stringify(group, null, 2));
  } catch (err) {
    // TODO (developer)- Handle exception from the API
    console.log('Failed with error %s', err.message);
  }
}

อัปเดตการตั้งค่าของกลุ่ม

ตัวอย่างนี้แสดงให้เห็นวิธีเปลี่ยนแปลงการตั้งค่าของกลุ่ม ตรงนี้จะมีการแก้ไขคำอธิบาย แต่การตั้งค่าอื่นๆ ก็เปลี่ยนแปลงในลักษณะเดียวกันได้

advanced/adminSDK.gs
/**
 * Updates group's settings. Here, the description is modified, but various
 * other settings can be changed in the same way.
 * @see https://developers.google.com/admin-sdk/groups-settings/v1/reference/groups/patch
 */
function updateGroupSettings() {
  const groupId = 'exampleGroup@example.com';
  try {
    const group = AdminGroupsSettings.newGroups();
    group.description = 'Newly changed group description';
    AdminGroupsSettings.Groups.patch(group, groupId);
  } catch (err) {
    // TODO (developer)- Handle exception from the API
    console.log('Failed with error %s', err.message);
  }
}