Click here to see your recently viewed pages and most viewed pages.
Apps Script

Groups Service


This service allows scripts to access Google Groups. It can be used to query information such as a group's email address, or the list of groups in which the user is a direct member. Here's an example that shows how many groups the current user is a member of:

var groups = GroupsApp.getGroups();
Logger.log('You are a member of %s Google Groups.', groups.length);


NameBrief description
GroupA group object whose members and those members' roles within the group can be queried.
GroupsAppThis class provides access to Google Groups information.
RolePossible roles of a user within a group, such as owner or ordinary member.

Class Group


MethodReturn typeBrief description
getEmail()StringGets this group's email address.
getRole(email)RoleRetrieves a user's role in the context of the group.
getRole(user)RoleRetrieves a user's role in the context of the group.
getUsers()User[]Retrieves all the direct members of the group.
hasUser(email)BooleanTests if a user is a direct member of the group.
hasUser(user)BooleanTests if a user is a direct member of the group.

Class GroupsApp




MethodReturn typeBrief description
getGroupByEmail(email)GroupRetrieves the group having the specified email address.
getGroups()Group[]Retrieves all the groups of which you are a direct member.

Class Role


OWNEREnumThe owner of a group.
MANAGEREnumThe manager of a group.
MEMBEREnumA user who is a member of this group but is neither an owner nor a manager.
INVITEDEnumA user who has been invited to join a group by an owner or manager of the group but who has not yet accepted the invitation.
PENDINGEnumA user who has requested to join a group but who has not yet been approved by an owner or manager.