빠른 시작에서는 Google Workspace API를 호출하는 앱을 설정하고 실행하는 방법을 설명합니다.
Google Workspace 빠른 시작에서는 API 클라이언트 라이브러리를 사용하여 인증 및 승인 흐름의 일부 세부정보를 처리합니다. 자체 앱에는 클라이언트 라이브러리를 사용하는 것이 좋습니다. 이 빠른 시작에서는 테스트 환경에 적합한 간소화된 인증 접근 방식을 사용합니다. 프로덕션 환경의 경우 앱에 적합한 액세스 사용자 인증 정보를 선택하기 전에 인증 및 승인에 관해 알아보는 것이 좋습니다.
/** * Lists users in a Google Workspace domain. * @see https://developers.google.com/admin-sdk/directory/reference/rest/v1/users/list */functionlistUsers(){constoptionalArgs={customer:'my_customer',maxResults:10,orderBy:'email'};try{constresponse=AdminDirectory.Users.list(optionalArgs);constusers=response.users;if(!users||users.length===0){console.log('Nousersfound.');return;}// Print the list of user's full name and emailconsole.log('Users:');for(constuserofusers){console.log('%s(%s)',user.primaryEmail,user.name.fullName);}}catch(err){// TODO (developer)- Handle exception from the Directory APIconsole.log('Failedwitherror%s',err.message);}}
[null,null,["최종 업데이트: 2025-01-27(UTC)"],[[["This quickstart demonstrates how to create a Google Apps Script that utilizes the Directory API to list users within a Google Workspace domain."],["Before running the script, ensure you have a Google Workspace account with API access, administrator privileges, and access to Google Drive."],["The provided code snippet needs to be copied into a new Apps Script project and the Admin Directory API needs to be enabled."],["After authorizing access, execute the script to view a list of users' full names and emails in the execution log."],["For production environments, it is recommended to explore authentication and authorization options further, rather than relying on the simplified approach used in the quickstart."]]],[]]