Maxamis4
Maxamis4

Reputation: 188

In Google App Scripts How can you get the group name with the group email

I have several alias's for my Google Groups. The Google console search is really bad and won't return the group if just type of the email address. I wanted to use Google App Script to pass the email address and have it return the name of the group. Simple right. I have not been able to find an SDK that actually returns the Google Group Name. I have samples that tell me whos a member, I can list attributes about the group but nothing shows me the name of the actual group. Anyone have links or information about how I can get this.

I have already look at Googles API site before someone adds the link:

https://developers.google.com/apps-script/reference/groups/groups-app

https://developers.google.com/apps-script/reference/groups/group

https://developers.google.com/apps-script/advanced/admin-sdk-groups-settings

If anyone has a link or informatin on how to do this it would be greatly appreciated.

Upvotes: 0

Views: 1081

Answers (1)

ale13
ale13

Reputation: 6072

What you want can be achieved by using the AdminGroupsSettings advanced service.

You need to turn the Groups Settings API service on by going to your project's Resources > Advanced Google services...

advanced google services

Afterwards, look for the Groups Settings API in the list and activate it. As it can be seen on the third column, you can call the service by using AdminGroupsSettings.

groups settings api

Then, just use the below snippet

function getGroup() {
  var groupName = AdminGroupsSettings.Groups.get('EMAIL_ADDRESS').name;
  console.log(groupName);
}

Reference

Upvotes: 1

Related Questions