/** * 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",};if(!AdminDirectory||!AdminDirectory.Users){thrownewError("Enable the AdminDirectory Advanced Service.");}constresponse=AdminDirectory.Users.list(optionalArgs);constusers=response.users;if(!users||users.length===0){console.log("No users found.");return;}// Print the list of user's full name and emailconsole.log("Users:");for(constuserofusers){if(user.primaryEmail){if(user.name?.fullName){console.log("%s (%s)",user.primaryEmail,user.name.fullName);}else{console.log("%s",user.primaryEmail);}}}}