First post ever, Looking to get some help here. I'm trying to run a daily job using googles apps scripts. I essentially want to export all groups within my google apps/suite domain (im a super admin) and list the users within them then have that data imported into a google sheet. Here's what I have so far. The documentation gives me a headache. Any help would be appreciated.
I've already done the initial steps to authorize
function readgroupsandusers() {
var pageToken, page;
do {
//Pulls down Admin SDK API that allows auth.
page = AdminDirectory.Groups.list({
domain: 'example@.com',
//Show max result of 500.
maxResults: 500,
pageToken: pageToken
});
//Presents group name + group email address.
var groups = page.groups;
if (groups) {
for (var i = 0; i < groups.length; i++) {
var group = groups[i];
Logger.log('%s (%s)', group.name, group.email);
var users
//I know something is suppose to go here...
}
}
else
//If it doesn't find anything present this message.
{
Logger.log('No Groups in this domain exist.');
}
pageToken = page.nextPageToken;
} while (pageToken);
}