AppScript Groups getUser() Permission Error

562 views Asked by At

I'm trying to use Google Apps Script to access the user list for a Group in my domain that I'm a member of, but I'm getting the error:

Exception: You do not have permission to view the member list for the group

The reference documentation says "Throws an exception if you do not have permission to view the group's member list" but I do have permission to view the member list.

Screenshot of group's "About" page showing I have permission to view the member list

My code is just:

GroupsApp.getGroupByEmail("[email protected]").getUsers();

But obviously with the real group's email address. It works perfectly for groups that I am the owner or manager of, but not that I am a member of (again, even though I do have permission to see the member list). Is there another setting somewhere where I don't have that permission? Is the documentation just misleading and it never works for mere members?

1

There are 1 answers

0
Jose Vasquez On BEST ANSWER

As I can see in the privacy setting, Group Members can view members. In addition to that you have to make sure that the Group Settings > Member Privacy > Who can view member email addresses is set to (for instance) Group Members if you wanted other members and not only the owners and managers the access to list the users in that group.

Keep in mind that when using GroupsApp.getGroupByEmail("[email protected]").getUsers(); you get a list of Users where each user is a model that contains the email of each member, that's why you need access to the email addresses.