AI-generated Key Takeaways
-  The Google Groups service allows scripts to access information about Google Groups, such as email addresses or member lists. 
-  The GroupsAppclass provides access to Google Groups information and methods likegetGroups()to retrieve the groups a user is a direct member of.
-  The Groupclass represents a group object, allowing queries about members and their roles.
-  The Roleclass defines the possible roles a user can have within a group, such as owner, manager, or member.
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 
 ); 
 
 
Classes
| Name | Brief description | 
|---|---|
|  Group 
 | A group object whose members and those members' roles within the group can be queried. | 
|  Groups  | This class provides access to Google Groups information. | 
|  Role 
 | Possible roles of a user within a group, such as owner or ordinary member. | 
  Group 
 
 
 Methods
| Method | Return type | Brief description | 
|---|---|---|
| String | Gets this group's email address. | |
|  Group[] 
 | Retrieves the direct child groups of the group. | |
|  Role 
 | Retrieves a user's role in the context of the group. | |
|  Role 
 | Retrieves a user's role in the context of the group. | |
|  Role[] 
 | Retrieves users' roles in the context of the group. | |
|  User[] 
 | Gets the direct members and banned members of the group that have a known corresponding Google account. | |
| Boolean | Tests if a group is a direct member of this group. | |
| Boolean | Tests if a group is a direct member of this group. | |
| Boolean | Tests if a user is a direct member of the group. | |
| Boolean | Tests if a user is a direct member of the group. | 
  Groups  
 
 Properties
| Property | Type | Description | 
|---|---|---|
| Role |  Role 
 | 
Methods
| Method | Return type | Brief description | 
|---|---|---|
|  Group 
 | Retrieves the group having the specified email address. | |
|  Group[] 
 | Retrieves all the groups of which you are a direct member (or a pending member). | 
  Role 
 
 
 Properties
| Property | Type | Description | 
|---|---|---|
| OWNER | Enum | The owner of a group. | 
| MANAGER | Enum | The manager of a group. | 
| MEMBER | Enum | A user who is a member of this group but is neither an owner nor a manager. | 
| INVITED | Enum | A 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. | 
| PENDING | Enum | A user who has requested to join a group but who has not yet been approved by an owner or manager. | 
| BANNED | Enum | A user who has been banned from a group and cannot attempt to join it. | 

