Admin SDK 群組設定服務
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
您可以使用 Admin SDK Groups Settings 服務,在 Apps Script 中使用 Admin SDK 的 Groups Settings API。這個 API 可讓 Google Workspace 網域管理員 (包括經銷商) 管理 Google Workspace 帳戶中群組的群組設定。
參考資料
如要進一步瞭解這項服務,請參閱 Admin SDK Groups Settings API 的參考文件。與 Apps Script 中的所有進階服務一樣,Admin SDK Groups Settings 服務使用的物件、方法和參數,都與公開 API 相同。詳情請參閱「如何判斷方法簽章」。
如要回報問題及尋求其他支援,請參閱管理員 SDK 群組設定支援指南。
程式碼範例
下列程式碼範例使用 API 第 1 版。
取得群組設定
這個範例會取得群組的設定,並記錄到控制台。
更新群組設定
這個範例說明如何變更群組的設定。這裡修改的是說明,但您也可以用相同方式變更其他設定。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-31 (世界標準時間)。
[null,null,["上次更新時間:2025-08-31 (世界標準時間)。"],[[["\u003cp\u003eThe Admin SDK Groups Settings service enables Google Workspace administrators to manage group settings within their accounts using Apps Script and the Groups Settings API.\u003c/p\u003e\n"],["\u003cp\u003eThis is an advanced service that requires enabling before use and mirrors the functionality of the public API.\u003c/p\u003e\n"],["\u003cp\u003eComprehensive reference documentation, support resources, and sample code are available to guide developers in using this service effectively, including examples for retrieving and updating group settings.\u003c/p\u003e\n"]]],[],null,["# Admin SDK Groups Settings Service\n\nThe Admin SDK Groups Settings service allows you to use the Admin SDK's\n[Groups Settings API](/admin-sdk/groups-settings) in Apps Script. This API\ngives administrators of Google Workspace domains\n(including resellers) the ability to manage the group settings for groups in\ntheir Google Workspace account.\n| **Note:** This is an advanced service that must be [enabled before use](/apps-script/guides/services/advanced).\n\nReference\n---------\n\nFor detailed information on this service, see the\n[reference documentation](/admin-sdk/groups-settings/v1/reference) for the\nAdmin SDK Groups Settings API. Like all advanced services in Apps Script, the\nAdmin SDK Groups Settings service uses the same objects, methods, and parameters\nas the public API. For more information, see [How method signatures are determined](/apps-script/guides/services/advanced#how_method_signatures_are_determined).\n\nTo report issues and find other support, see the\n[Admin SDK Groups Settings support guide](/admin-sdk/groups-settings/support).\n\nSample code\n-----------\n\nThe sample code below uses [version 1](/admin-sdk/groups-settings/v1/reference)\nof the API.\n\n### Get a group's settings\n\nThis sample gets a group's settings and logs them to the console. \nadvanced/adminSDK.gs \n[View on GitHub](https://github.com/googleworkspace/apps-script-samples/blob/main/advanced/adminSDK.gs) \n\n```javascript\n/**\n * Gets a group's settings and logs them to the console.\n */\nfunction getGroupSettings() {\n // TODO (developer) - Replace groupId value with yours\n const groupId = 'exampleGroup@example.com';\n try {\n const group = AdminGroupsSettings.Groups.get(groupId);\n console.log(JSON.stringify(group, null, 2));\n } catch (err) {\n // TODO (developer)- Handle exception from the API\n console.log('Failed with error %s', err.message);\n }\n}\n```\n\n### Update a group's settings\n\nThis sample shows how a group's settings can be changed. Here, the description\nis modified, but various other settings can be changed in the same way.\n\n\nadvanced/adminSDK.gs \n[View on GitHub](https://github.com/googleworkspace/apps-script-samples/blob/main/advanced/adminSDK.gs) \n\n```javascript\n/**\n * Updates group's settings. Here, the description is modified, but various\n * other settings can be changed in the same way.\n * @see https://developers.google.com/admin-sdk/groups-settings/v1/reference/groups/patch\n */\nfunction updateGroupSettings() {\n const groupId = 'exampleGroup@example.com';\n try {\n const group = AdminGroupsSettings.newGroups();\n group.description = 'Newly changed group description';\n AdminGroupsSettings.Groups.patch(group, groupId);\n } catch (err) {\n // TODO (developer)- Handle exception from the API\n console.log('Failed with error %s', err.message);\n }\n}\n```\n\n\u003cbr /\u003e"]]