Reputation: 159
My company has registered gmail apps for our own domain, my question seems to be simple: how can I retrieve the list of gmail user address within the company domain via google API, can anyone offer me a reference or any solution?
Upvotes: 1
Views: 3770
Reputation: 1
you can obtain the list of user added in your domain by using UserManager() function of Google API, but the UserManager only allows the admin of the account to retrieve the data.
here is the code for reference:
function myFunction() {
var users = UserManager.getAllUsers();
for (var i in users) {
Logger.log(users[i].getEmail());
}
}
output of the code: it will give you the email address of all the users of you domain, you can view that in the logs
Upvotes: 0
Reputation: 5601
You can also get it via UserManager.getAllUsers() in Google Apps Script https://developers.google.com/apps-script/class_usermanager
Upvotes: 0
Reputation: 1618
The provisioning API has an API call to retrieve all users in a domain.
Update Just realized - there's already a duplicate question here: List emails of clients accounts on Google Apps
Upvotes: 2