Admin SDK 그룹스 설정 서비스

Admin SDK 그룹스 설정 서비스를 사용하면 Apps Script에서 Admin SDK의 Groups Settings API를 사용할 수 있습니다. 이 API를 사용하면 Google Workspace 도메인(리셀러 포함) 관리자는 Google Workspace 계정에서 그룹의 그룹 설정을 관리할 수 있습니다.

참조

이 서비스에 대한 자세한 내용은 Admin SDK Groups Settings API의 참조 문서를 확인하세요. Apps Script의 모든 고급 서비스와 마찬가지로 Admin SDK 그룹스 설정 서비스는 공개 API와 동일한 객체, 메서드, 매개변수를 사용합니다. 자세한 내용은 메서드 서명 확인 방법을 참조하세요.

문제를 신고하고 다른 지원을 받으려면 Admin 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);
  }
}