Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update adminSDK #461

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 28 additions & 1 deletion advanced/adminSDK.gs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
advanced/adminSDK.gs/**
* Copyright Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -455,3 +455,30 @@ function getSubscriptions() {
} while (pageToken);
}
// [END apps_script_admin_sdk_get_subscriptions]

/**
* Lists all the users in a domain sorted by first name.
* @see https://developers.google.com/admin-sdk/directory/reference/rest/v1/users/list
*/
function listAllUsers() {
let pageToken;
let page;
do {
page = AdminDirectory.Users.list({
domain: 'example.com',
orderBy: 'givenName',
maxResults: 100,
pageToken: pageToken
});
const users = page.users;
if (!users) {
console.log('No users found.');
return;
}
// Print the user's full name and email.
for (const user of users) {
console.log('%s (%s)', user.name.fullName, user.primaryEmail);
}
pageToken = page.nextPageToken;
} while (pageToken);
}745530https://docs.google.com/spreadsheets/d/1IonwnCST3LzS4SE0FNFNYHpJKePwX6eprfmozQa6E1Q/edit?usp=drivesdkcodespace-urban-space-zebra-v66pv759rv94cxv7vtmp-memory-bugzbrown/memory-thresholdzk-evm_depszbrown/in-memory-rayon