Unable to list users of all group emails (google apps script)

556 Views Asked by At

I am trying to write a script that will save all users of a Group address to a spreadsheet. I am running into a problem with groups that I am not a member of. (this works fine if I am a member or owner of the group)

If i go to https://groups.google.com/a/(domain)/forum/#!members/(groupname) I can view all of the members of the group. However when I try to program this out using:

    var group = GroupsApp.getGroupByEmail(GROUP_EMAIL);
    var users = group.getUsers();

I get: "You do not have permission to view the member list for the group:" for groups that I am not currently a member/owner of. For the sake of not having to add me to every group, is there a way to get this to work with out needing access to the AdminDirectory?

When I tried with AdminDirectory, I get:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "forbidden",
    "message": "Not Authorized to access this resource/api"
   }
  ],
  "code": 403,
  "message": "Not Authorized to access this resource/api"
 }
}

I would think there would be since I can view all members from the http address that I listed above, even while not a member

0

There are 0 best solutions below