Admin SDK Groups Settings サービス

Admin SDK Groups Settings サービスを使用すると、Apps Script で Admin SDK の Groups Settings API を使用できます。この API を使用すると、 ドメインの管理者(販売パートナー様を含む)は、 アカウント内のグループのグループ設定を管理できます。

リファレンス

このサービスの詳細については、Admin SDK Groups Settings API のリファレンス ドキュメントをご覧ください。Apps Script のすべての高度なサービスと同様に、Admin SDK Groups Settings サービスでは、公開 API と同じオブジェクト、メソッド、パラメータを使用します。詳細については、メソッド シグネチャの決定方法をご覧ください。

問題を報告したり、その他のサポートを確認したりするには、Admin SDK Groups Settings サポートガイドをご覧ください。

サンプルコード

以下のサンプルコードでは、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);
  }
}