4

This question is the inverse of another question. In corporate gmail, I know how to view a list of members for a particular group, but how do I perform the reverse of this? That is, how do I find out which groups John Doe belongs to?

Use case - I need to send an email with a database question. I know that John Doe is a Database Administrator, but I'd rather email the group of DBAs instead of just John. In Outlook, this could be accomplished by double-clicking on John's name; then his email groups would be listed under Memberships (or something like that).

2

I've never found a good solution to this. Instead, I've used a work around. I have a script that gives me a full list of all of the groups I can access and lists of their members. When I run "main" it creates a Google sheet called "Group List". Although it's not refined, it gets the job done.

function main() {
  var doc = SpreadsheetApp.create("Group List");
  GroupsApp.getGroups()
  var groups = GroupsApp.getGroups();
  for (var i = 0; i < groups.length; i++) {
    var group = groups[i];
    var gemail = group.getEmail();
    if (group.getEmail().indexOf("my-email-domain") > 0) {
        Logger.log(group.getEmail());
        listGroupMembers(doc, group)
    }
  }

}

function listGroupMembers(doc, group) {
  var GROUP_EMAIL = group.getEmail();
  try {
    var users = group.getUsers();

     var s = "Group " + GROUP_EMAIL + " has " + users.length +
     " members: ";
     for (var i = 0; i < users.length; i++) {
       var user = users[i];
       var user_email = user.getEmail();
       s = s + user_email + ", ";
       doc.appendRow([GROUP_EMAIL, user_email]);
     }
     Logger.log(s);
  }
  catch(err) {
    Logger.log("ERROR: " + err.message);
  }
}
1

I've looked in Gmail, Google Contacts, Google Plus and Groups and couldn't find this information. As a Google Apps Admin, however, I can lookup the user and see their groups from their User Account Page.

enter image description here

If someone else has a better answer I would love to know as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.