-
Notifications
You must be signed in to change notification settings - Fork 473
Users Group Membership
- API documentation
- Definitions
- Add users to groups
- Delete users from groups
- Delete external user from groups
- Update users group roles and delivery settings
- Synchronize users group membership
- Check users group membership
-
Display users group membership
- Display group names as an indented list
- Display group names in CSV format
- Display group details as an indented list
- Display group details in CSV format
- Display group counts as an indented list
- Display group counts in CSV format
- Display total group counts as an indented list
- Display total group counts in CSV format
- Display group addresses in CSV format
- Display groups and their parents
- Add a target user to the same groups as a source user
<DeliverySetting> ::=
allmail|
abridged|daily|
digest|
disabled|
none|nomail
<DomainName> ::= <String>(.<String>)+
<EmailAddress> ::= <String>@<DomainName>
<UniqueID> ::= id:<String>
<GroupItem> ::= <EmailAddress>|<UniqueID>|<String>
<GroupList> ::= "<GroupItem>(,<GroupItem>)*"
<GroupEntity> ::=
<GroupList> | <FileSelector> | <CSVkmdSelector> | <CSVDataSelector>
See: https://github.com/GAM-team/GAM/wiki/Collections-of-Items
<GroupRole> ::= owner|manager|member
<GroupRoleList> ::= "<GroupRole>(,<GroupRole>)*"
Add each user in <UserTypeEntity>
to all of the groups specified by ([<GroupRole>] <GroupEntity>)+
.
If <GroupRole>
is not specified, member
is assumed.
gam <UserTypeEntity> add group|groups
([<GroupRole>] [[delivery] <DeliverySetting>] <GroupEntity>)+
Add a user to several groups with different roles.
$ gam user testuser1@domain.com add groups owner testgroup1@domain.com manager testgroup2@domain.com member testgroup3@domain.com,testgroup4@domain.com
User: testuser1@domain.com, Add to 4 Groups
Group: testgroup1@domain.com, Owner: testuser1@domain.com, Added (1/4)
Group: testgroup2@domain.com, Manager: testuser1@domain.com, Added (2/4)
Group: testgroup3@domain.com, Member: testuser1@domain.com, Added (3/4)
Group: testgroup4@domain.com, Member: testuser1@domain.com, Added (4/4)
Use a CSV file to specify users, groups and roles.
# Desired state
$ more UserGroupRole.csv
User,Group,Role,Status,Delivery
testuser1@domain.com,testgroup1@domain.com,OWNER,ACTIVE,DIGEST
testuser1@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,DAILY
testuser1@domain.com,testgroup3@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup4@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser2@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser2@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,ALL_MAIL
testuser3@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser3@domain.com,testgroup2@domain.com,OWNER,ACTIVE,NONE
# Current state
$ gam csvkmd users UserGroupRole.csv keyfield User print groups
User,Group,Role,Status,Delivery
# Add users to groups
$ gam redirect stdout - multiprocess csv UserGroupRole.csv gam user "~User" add group "~Role" "~Delivery" "~Group"
Using 5 processes...
User: testuser1@domain.com, Add to 1 Group
Group: testgroup1@domain.com, Owner: testuser1@domain.com, Added
User: testuser1@domain.com, Add to 1 Group
Group: testgroup4@domain.com, Member: testuser1@domain.com, Added
User: testuser2@domain.com, Add to 1 Group
Group: testgroup1@domain.com, Member: testuser2@domain.com, Added
User: testuser1@domain.com, Add to 1 Group
Group: testgroup3@domain.com, Member: testuser1@domain.com, Added
User: testuser1@domain.com, Add to 1 Group
Group: testgroup2@domain.com, Manager: testuser1@domain.com, Added
User: testuser3@domain.com, Add to 1 Group
Group: testgroup1@domain.com, Member: testuser3@domain.com, Added
User: testuser2@domain.com, Add to 1 Group
Group: testgroup2@domain.com, Manager: testuser2@domain.com, Added
User: testuser3@domain.com, Add to 1 Group
Group: testgroup2@domain.com, Owner: testuser3@domain.com, Added
# Final state
$ gam csvkmd users UserGroupRole.csv keyfield User print groups
User,Group,Role,Status,Delivery
testuser1@domain.com,testgroup1@domain.com,OWNER,ACTIVE,DIGEST
testuser1@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,DAILY
testuser1@domain.com,testgroup3@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup4@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser2@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser2@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,ALL_MAIL
testuser3@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser3@domain.com,testgroup2@domain.com,OWNER,ACTIVE,NONE
gam <UserTypeEntity> delete group|groups
[(domain <DomainName>)|(customerid <CustomerID>)|
(emailmatchpattern [not] <RegularExpression>)|<GroupEntity>]
By default, users will be deleted from all groups of which they are a member, these options allow selection of subsets of groups:
-
domain <DomainName>
- Delete from all groups in the domain<DomainName>
of which they are a member -
customerid <CustomerID>
- For resellers, delete from all groups in a resold workspace of which they are a member -
emailmatchpattern [not] <RegularExpression>
- Delete from all groups of which they are a member based on (not) matching the group email address -
<GroupEntity>
- Delete from a specific list of groups
Delete a user from all groups to which it belongs.
$ gam user testuser1@domain.com delete groups
User: testuser1@domain.com, Delete from 4 Groups
Group: testgroup1@domain.com, Member: testuser1@domain.com, Deleted (1/4)
Group: testgroup2@domain.com, Member: testuser1@domain.com, Deleted (2/4)
Group: testgroup3@domain.com, Member: testuser1@domain.com, Deleted (3/4)
Group: testgroup4@domain.com, Member: testuser1@domain.com, Deleted (4/4)
Delete users from all groups to which they belong. Assume a CSV file NoGroupsUsers.csv with a column labelled primaryEmail that lists the users.
gam csv NoGroupsUsers.csv gam user "~primaryEmail" delete groups
Use a CSV file to specify users and groups.
# Current state
$ gam csvkmd users UserGroupRole.csv keyfield User print groups
User,Group,Role,Status,Delivery
testuser1@domain.com,testgroup1@domain.com,OWNER,ACTIVE,DIGEST
testuser1@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,DAILY
testuser1@domain.com,testgroup3@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup4@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser2@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser2@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,ALL_MAIL
testuser3@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser3@domain.com,testgroup2@domain.com,OWNER,ACTIVE,NONE
# Delete users from groups
$ gam csvkmd users UserGroupRole.csv keyfield User delete groups
User: testuser1@domain.com, Delete from 4 Groups (1/3)
Group: testgroup1@domain.com, Member: testuser1@domain.com, Deleted (1/4)
Group: testgroup2@domain.com, Member: testuser1@domain.com, Deleted (2/4)
Group: testgroup3@domain.com, Member: testuser1@domain.com, Deleted (3/4)
Group: testgroup4@domain.com, Member: testuser1@domain.com, Deleted (4/4)
User: testuser2@domain.com, Delete from 2 Groups (2/3)
Group: testgroup1@domain.com, Member: testuser2@domain.com, Deleted (1/2)
Group: testgroup2@domain.com, Member: testuser2@domain.com, Deleted (2/2)
User: testuser3@domain.com, Delete from 2 Groups (3/3)
Group: testgroup1@domain.com, Member: testuser3@domain.com, Deleted (1/2)
Group: testgroup2@domain.com, Member: testuser3@domain.com, Deleted (2/2)
# Final state
$ gam csvkmd users UserGroupRole.csv keyfield User print groups
User,Group,Role,Status,Delivery
There is a user from outside of your domain that you would like to delete from all groups.
$ gam user user@external.com delete groups
User: user@external.com, Delete from 0 Groups
There is a Goggle issue that causes this to fail for a few external addresses. To solve this problem, you need the unique ID for the external address; the following steps show how to do this.
Create a test group.
$ gam create group testexternal description "Test External Email Addresses"
Group: testexternal@domain.com, Created
Add the external address to that group.
$ gam update group testexternal add member user@external.com
Group: testexternal@domain.com, Add 1 Member
Group: testexternal@domain.com, Member: user@external.com, Added: Role: MEMBER
Print the group members of the group to get the unique ID of the external address.
$ gam print group-members group testexternal
Getting all Members, Managers, Owners for testexternal@domain.com
group,type,role,id,status,email
testexternal@domain.com,USER,MEMBER,123406166545652215678,,user@external.com
Delete the external address from all groups.
$ gam user uid:123406166545652215678 delete groups
User: 123406166545652215678, Delete from 2 Groups
Group: testexternal@domain.com, Member: 123406166545652215678, Deleted (1/2)
Group: testgroup@domain.com, Member: 123406166545652215678, Deleted (2/2)
For each user in <UserTypeEntity>
update their current group role and delivery settings.
gam <UserTypeEntity> update group|groups
[(domain <DomainName>)|(customerid <CustomerID>)]) [<GroupRole>] [[delivery] <DeliverySetting>]
([<GroupRole>] [[delivery] <DeliverySetting>] [<GroupEntity>])*
By default, update user roles and delivery settings for all groups of which they are a member, these options allow selection of subsets of groups:
-
domain <DomainName>
- Update user role and delivery settings for all groups in the domain<DomainName>
of which they are a member -
customerid <CustomerID>
- For resellers, update user role and delivery settings for all groups in a resold workspace of which they are a member -
<GroupEntity>
- Update user role and delivery settings for a specific list of groups; you can specify different roles and delivery settings for different group lists
# Current state
$ gam csvkmd users UserGroupRole.csv keyfield User print groups
User,Group,Role,Status,Delivery
testuser1@domain.com,testgroup1@domain.com,OWNER,ACTIVE,DIGEST
testuser1@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,DAILY
testuser1@domain.com,testgroup3@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup4@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser2@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser2@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,ALL_MAIL
testuser3@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser3@domain.com,testgroup2@domain.com,OWNER,ACTIVE,NONE
# Desired changes
$ more UserGroupRoleNew.csv
User,Group,Role,Status,Delivery
testuser1@domain.com,testgroup2@domain.com,OWNER,ACTIVE,DIGEST
testuser2@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,DAILY
testuser3@domain.com,testgroup2@domain.com,OWNER,ACTIVE,DIGEST
# Update roles/delivery settings
$ gam redirect stdout - multiprocess csv UserGroupRoleNew.csv gam user "~User" update group "~Role" "~Delivery" "~Group"
Using 3 processes...
User: testuser2@domain.com, Update to 1 Group
Group: testgroup2@domain.com, Manager: testuser2@domain.com, Updated
User: testuser3@domain.com, Update to 1 Group
Group: testgroup2@domain.com, Owner: testuser3@domain.com, Updated
User: testuser1@domain.com, Update to 1 Group
Group: testgroup2@domain.com, Owner: testuser1@domain.com, Updated
# Final state
$ gam csvkmd users UserGroupRole.csv keyfield User print groups
User,Group,Role,Status,Delivery
testuser1@domain.com,testgroup1@domain.com,OWNER,ACTIVE,DIGEST
testuser1@domain.com,testgroup2@domain.com,OWNER,ACTIVE,DIGEST
testuser1@domain.com,testgroup3@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup4@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser2@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser2@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,DAILY
testuser3@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser3@domain.com,testgroup2@domain.com,OWNER,ACTIVE,DIGEST
For each user in <UserTypeEntity>
get their current group membership and do adds and deletes as necessary to match ([<GroupRole>] <GroupEntity>)+
.
If <GroupRole>
is not specified, member
is assumed.
gam <UserTypeEntity> sync group|groups
[(domain <DomainName>)|(customerid <CustomerID>)]
[<GroupRole>] [[delivery] <DeliverySetting>] <GroupEntity>)*
By default, users will be synchronized with all groups of which they are a member, these options allow selection of subsets of groups:
-
domain <DomainName>
- Synchronize with all groups in the domain<DomainName>
of which they are a member -
customerid <CustomerID>
- For resellers, synchronize with all groups in a resold workspace of which they are a member
# Current state
$ gam user testuser1@domain.com print groups
User,Group,Role
testuser1@domain.com,testgroup2@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup3@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup4@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup5@domain.com,MEMBER,ACTIVE,ALL_MAIL
# Update membership
$ gam user testuser1@domain.com sync groups owner testgroup1@domain.com manager testgroup2@domain.com member testgroup3@domain.com,testgroup4@domain.com
User: testuser1@domain.com, Remove from 1 Group
Group: testgroup5@domain.com, Member: testuser1@domain.com, Removed
User: testuser1@domain.com, Add to 1 Group
Group: testgroup1@domain.com, Owner: testuser1@domain.com, Added
User: testuser1@domain.com, Update in 1 Group
Group: testgroup2@domain.com, Manager: testuser1@domain.com, Updated
# Final state
$ gam user testuser1@domain.com print groups
User,Group,Role
testuser1@domain.com,testgroup1@domain.com,OWNER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup3@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup4@domain.com,MEMBER,ACTIVE,ALL_MAIL
# Current state
$ gam csvkmd users UserGroupRole.csv keyfield User print groups
User,Group,Role,Status,Delivery
testuser1@domain.com,testgroup1@domain.com,OWNER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup3@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup4@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup5@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser2@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser2@domain.com,testgroup2@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser3@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL
# Desired state
$ more UserGroupRole.csv
User,Group,Role,Status,Delivery
testuser1@domain.com,testgroup1@domain.com,OWNER,ACTIVE,DIGEST
testuser1@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,DAILY
testuser1@domain.com,testgroup3@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup4@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser2@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser2@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,ALL_MAIL
testuser3@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser3@domain.com,testgroup2@domain.com,OWNER,ACTIVE,NONE
# Update membership
$ gam csvkmd users UserGroupRole.csv keyfield User subkeyfield Role datafield Group sync groups csvdata Group
User: testuser1@domain.com, Remove from 1 Group (1/3)
Group: testgroup5@domain.com, Member: testuser1@domain.com, Removed
User: testuser2@domain.com, Update to 1 Group (2/3)
Group: testgroup2@domain.com, Manager: testuser2@domain.com, Updated
User: testuser3@domain.com, Add to 1 Group (3/3)
Group: testgroup2@domain.com, Owner: testuser3@domain.com, Added
# Intermediate state
$ gam csvkmd users UserGroupRole.csv keyfield User print groups
User,Group,Role,Status,Delivery
testuser1@domain.com,testgroup1@domain.com,OWNER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup3@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup4@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser2@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser2@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,ALL_MAIL
testuser3@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser3@domain.com,testgroup2@domain.com,OWNER,ACTIVE,ALL_MAIL
# Update roles/delivery settings
$ gam redirect stdout - multiprocess csv UserGroupRole.csv gam user "~User" update group "~Role" "~Delivery" "~Group"
Using 5 processes...
User: testuser2@domain.com, Update to 1 Group
Group: testgroup1@domain.com, Member: testuser2@domain.com, Updated
User: testuser1@domain.com, Update to 1 Group
Group: testgroup4@domain.com, Member: testuser1@domain.com, Updated
User: testuser1@domain.com, Update to 1 Group
Group: testgroup3@domain.com, Member: testuser1@domain.com, Updated
User: testuser1@domain.com, Update to 1 Group
Group: testgroup2@domain.com, Manager: testuser1@domain.com, Updated
User: testuser1@domain.com, Update to 1 Group
Group: testgroup1@domain.com, Owner: testuser1@domain.com, Updated
User: testuser3@domain.com, Update to 1 Group
Group: testgroup1@domain.com, Member: testuser3@domain.com, Updated
User: testuser2@domain.com, Update to 1 Group
Group: testgroup2@domain.com, Manager: testuser2@domain.com, Updated
User: testuser3@domain.com, Update to 1 Group
Group: testgroup2@domain.com, Owner: testuser3@domain.com, Updated
# Final state
$ gam csvkmd users UserGroupRole.csv keyfield User print groups
User,Group,Role,Status,Delivery
testuser1@domain.com,testgroup1@domain.com,OWNER,ACTIVE,DIGEST
testuser1@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,DAILY
testuser1@domain.com,testgroup3@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup4@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser2@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser2@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,ALL_MAIL
testuser3@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser3@domain.com,testgroup2@domain.com,OWNER,ACTIVE,NONE
For each user in <UserTypeEntity>
check if they are members of the groups in <GroupEntity>
with a role
in role <GroupsRoleList>
; if not specified, any role is acceptable.
gam <UserTypeEntity> check group|groups
[roles <GroupRoleList>] [includederivedmembership] [csv] <GroupEntity>
By default, only direct membership is checked; include the includederivedmembership
to check
if a user is a member of a group or one of its sub-groups.
By default, the output is indented keys and values written to stdout;
use the csv
option to write the output to a CSV file.
A return code of 0 indicates that a user is a member of all of the groups with an acceptable role; a return code of 29 indicates that the user is not a member of all of the groups.
It takes one API call to get the list of groups to which a user belongs.
There is one row per group to which a user belongs.
gam <UserTypeEntity> show groups
[(domain <DomainName>)|(customerid <CustomerID>)]
[roles <GroupRoleList>] nodetails
There is one row per user/group combination.
gam <UserTypeEntity> print groups [todrive <ToDriveAttribute>*]
[(domain <DomainName>)|(customerid <CustomerID>)]
[roles <GroupRoleList>] nodetails
By default, all groups to which a member belongs are displayed, these options allow selection of subsets of groups:
-
domain <DomainName>
- Limit display to groups in the domain<DomainName>
of which they are a member -
customerid <CustomerID>
- For resellers, display all groups in a resold workspace of which they are a member -
roles <GroupRoleList>
- Limit display to those groups for which the user has a specific role
There is one row per group to which a user belongs showing role, status and delivery information.
There is one API call per user/group to get the user's role and delivery settings.
gam <UserTypeEntity> show groups
[(domain <DomainName>)|(customerid <CustomerID>)]
[roles <GroupRoleList>]
There is one row per user/group combination displaying role, status and delivery information.
There is one API call per user/group to get the user's role and delivery settings.
gam <UserTypeEntity> print groups [todrive <ToDriveAttribute>*]
[(domain <DomainName>)|(customerid <CustomerID>)]
[roles <GroupRoleList>]
By default, all groups to which a member belongs are displayed, these options allow selection of subsets of groups:
-
domain <DomainName>
- Limit display to groups in the domain<DomainName>
of which they are a member -
customerid <CustomerID>
- For resellers, display all groups in a resold workspace of which they are a member -
roles <GroupRoleList>
- Limit display to those groups for which the user has a specific role
There is one row per user displaying the number of groups, by role, to which a user belongs.
There is one API call per user/group to get the user's role.
gam <UserTypeEntity> show groups
[(domain <DomainName>)|(customerid <CustomerID>)]
[roles <GroupRoleList>] countsonly
By default, all groups to which a member belongs are displayed, these options allow selection of subsets of groups:
-
domain <DomainName>
- Limit display to groups in the domain<DomainName>
of which they are a member -
customerid <CustomerID>
- For resellers, display all groups in a resold workspace of which they are a member -
roles <GroupRoleList>
- Limit display to those groups for which the user has a specific role
There is one row per user displaying the number of groups, by role, to which a user belongs.
There is one API call per user/group to get the user's role.
gam <UserTypeEntity> print groups [todrive <ToDriveAttribute>*]
[(domain <DomainName>)|(customerid <CustomerID>)]
[roles <GroupRoleList>] countsonly
By default, all groups to which a member belongs are displayed, these options allow selection of subsets of groups:
-
domain <DomainName>
- Limit display to groups in the domain<DomainName>
of which they are a member -
customerid <CustomerID>
- For resellers, display all groups in a resold workspace of which they are a member -
roles <GroupRoleList>
- Limit display to those groups for which the user has a specific role
There is one row per user displaying the number of groups to which a user belongs.
There is one API call per user to get the total group count.
gam <UserTypeEntity> show groups
[(domain <DomainName>)|(customerid <CustomerID>)]
totalonly
By default, all groups to which a member belongs are displayed, these options allow selection of subsets of groups:
-
domain <DomainName>
- Limit display to groups in the domain<DomainName>
of which they are a member -
customerid <CustomerID>
- For resellers, display all groups in a resold workspace of which they are a member
There is one row per user displaying the total number of groups to which a user belongs.
There is one API call per user to get the total group count.
gam <UserTypeEntity> print groups [todrive <ToDriveAttribute>*]
[(domain <DomainName>)|(customerid <CustomerID>)]
totalonly
By default, all groups to which a member belongs are displayed, these options allow selection of subsets of groups:
-
domain <DomainName>
- Limit display to groups in the domain<DomainName>
of which they are a member -
customerid <CustomerID>
- For resellers, display all groups in a resold workspace of which they are a member
There is one row per user showing the number and list of groups to which a user directly belongs.
gam <UserTypeEntity> print groupslist [todrive <ToDriveAttribute>*]
[(domain <DomainName>)|(customerid <CustomerID>)]
[delimiter <Character>] [quotechar <Character>]
By default, all groups to which a member belongs are displayed, these options allow selection of subsets of groups:
-
domain <DomainName>
- Limit display to groups in the domain<DomainName>
of which they are a member -
customerid <CustomerID>
- For resellers, display all groups in a resold workspace of which they are a member
By default, the entries in lists of groups are separated by the csv_output_field_delimiter' from
gam.cfg`.
-
delimiter <Character>
- Separate list items with<Character>
By default, when writing CSV files, Gam uses a quote character of double quote "
. The quote character is used to enclose columns that contain
the quote character itself, the column delimiter (comma by default) and new-line characters. Any quote characters within the column are doubled.
The quotechar <Character>
option allows you to choose an alternate quote character, single quote for instance, that makes for readable/processable output.
quotechar
defaults to gam.cfg/csv_output_quote_char
. When uploading CSV files to Google, double quote "
should be used.
$ gam user testuser1@domain.com show groups
User: testuser1@domain.com, Show 4 Groups
Group: testgroup1@domain.com, Role: OWNER, Status: ACTIVE, Delivery: DIGEST (1/4)
Group: testgroup2@domain.com, Role: MANAGER, Status: ACTIVE, Delivery: DAILY (2/4)
Group: testgroup3@domain.com, Role: MEMBER, Status: ACTIVE, Delivery: ALL_MAIL (3/4)
Group: testgroup4@domain.com, Role: MEMBER, Status: ACTIVE, Delivery: ALL_MAIL (4/4)
$ gam user testuser1@domain.com print groups
User,Group,Role,Status,Delivery
testuser1@domain.com,testgroup1@domain.com,OWNER,ACTIVE,DIGEST
testuser1@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,DAILY
testuser1@domain.com,testgroup3@domain.com,MEMBER,ACTIVE,ALL_MAIL
testuser1@domain.com,testgroup4@domain.com,MEMBER,ACTIVE,ALL_MAIL
$ gam csvkmd users UserGroupRole.csv keyfield User show groups role owner
User: testuser1@domain.com, Show maximum of 4 Groups (1/3)
Group: testgroup1@domain.com, Role: OWNER, Status: ACTIVE, Delivery: DIGEST (1/4)
User: testuser2@domain.com, Show maximum of 2 Groups (2/3)
User: testuser3@domain.com, Show maximum of 2 Groups (3/3)
Group: testgroup2@domain.com, Role: OWNER, Status: ACTIVE, Delivery: NONE (2/2)
$ gam csvkmd users UserGroupRole.csv keyfield User print groups role owner
User,Group,Role,Status,Delivery
testuser1@domain.com,testgroup1@domain.com,OWNER,ACTIVE,DIGEST
testuser3@domain.com,testgroup2@domain.com,OWNER,ACTIVE,NONE
$ gam users testuser1,testuser2 show groups domain domain.net
User: testuser1@domain.com, Show maximum of 2 Groups (1/2)
Group: testgroup@domain.net, Role: MEMBER (1/2)
Group: testnet@domain.net, Role: MEMBER (2/2)
User: testuser2@domain.com, Show maximum of 0 Groups (2/2)
$ gam users testuser1,testuser2 print groups domain domain.net
User,Group,Role
testuser1@domain.com,testgroup@domain.net,MEMBER
testuser1@domain.com,testnet@domain.net,MEMBER
$ gam users testuser1,testuser2 print groupslist
Getting all Groups for testuser1@domain.com (1/2)
Getting all Groups for testuser2@domain.com (2/2)
User,Groups,GroupsList
testuser1@domain.com,6,classroom_teachers@domain.com testfromgroup@domain.com testgroup1@domain.com testgroup2@domain.com testgroup4@domain.com testgroup@domain.com
testuser2@domain.com,0,
$ gam config csv_output_row_filter "Groups:count=0" users testuser1,testuser2 print groupslist
Getting all Groups for testuser1@domain.com (1/2)
Getting all Groups for testuser2@domain.com (2/2)
User,Groups,GroupsList
testuser2@domain.com,0,
Display a user's groups and their parents as an indented list.
gam <UserTypeEntity> show grouptree
[(domain <DomainName>)|(customerid <CustomerID>)]
[roles <GroupRoleList>]
By default, all groups to which a member belongs are displayed, these options allow selection of subsets of groups:
-
domain <DomainName>
- Limit display to groups in the domain<DomainName>
of which they are a member -
customerid <CustomerID>
- For resellers, display all groups in a resold workspace of which they are a member
By default, all of a users's groups are displayed without role information. Displaying role information requires an additional API call per user/group combination.
-
roles <GroupRoleList>
- Display groups with role information where the user has one of the specified roles
Display a user's groups and their parents in CSV format.
gam <UserTypeEntity> print grouptree [todrive <ToDriveAttribute>*]
[(domain <DomainName>)|(customerid <CustomerID>)]
[roles <GroupRoleList>]
[showparentsaslist [<Boolean>]] [delimiter <Character>]
By default, all groups to which a member belongs are displayed, these options allow selection of subsets of groups:
-
domain <DomainName>
- Limit display to groups in the domain<DomainName>
of which they are a member -
customerid <CustomerID>
- For resellers, display all groups in a resold workspace of which they are a member
By default, all of a users's groups are displayed without role information. Displaying role information requires an additional API call per user/group combination.
-
roles <GroupRoleList>
- Display groups with role information where the user has one of the specified roles
By default, the group parent emails and names are displayed in multiple indexed columns.
Use options showparentsaslist [<Boolean>]
and delimiter <Character>
to display
the group parent emails and names in two columns as delimited lists .
$ gam user testuser1@domain.com show grouptree
User: testuser1@domain.com, Show maximum of 4 Group Trees
testgroup1@domain.com: Test Group1 (1/4)
testgroup@domain.com: Test Group Org
testgroup2@domain.com: Test - Group 2 (2/4)
testgroup1@domain.com: Test Group1
testgroup@domain.com: Test Group Org
testgroup@domain.net: Test Group Net
testgroup3@domain.com: Test - Group 3 (3/4)
testgroup@domain.com: Test Group Org (4/4)
$ gam user testuser1@domain.com show grouptree roles member,manager,owner
User: testuser1@domain.com, Show 4 Group Trees
testgroup1@domain.com: Test Group1, Role: MEMBER (1/4)
testgroup@domain.com: Test Group Org
testgroup2@domain.com: Test - Group 2, Role: MEMBER (2/4)
testgroup1@domain.com: Test Group1
testgroup@domain.com: Test Group Org
testgroup@domain.net: Test Group Net
testgroup3@domain.com: Test - Group 3, Role: MANAGER (3/4)
testgroup@domain.com: Test Group Org, Role: MEMBER (4/4)
$ gam user testuser1@domain.com show grouptree roles manager
User: testuser1@domain.com, Show maximum of 4 Group Trees
testgroup3@domain.com: Test - Group 3, Role: MANAGER (3/4)
$ gam user testuser1@domain.com print grouptree
User,Group,Name,parents,parents.0.email,parents.0.name,parents.1.email,parents.1.name
testuser1@domain.com,testgroup1@domain.com,Test Group1,1,testgroup@domain.com,Test Group Org,,
testuser1@domain.com,testgroup2@domain.com,Test - Group 2,2,testgroup1@domain.com,Test Group1,testgroup@domain.com,Test Group Org
testuser1@domain.com,testgroup2@domain.com,Test - Group 2,1,testgroup@domain.net,Test Group Net,,
testuser1@domain.com,testgroup3@domain.com,Test - Group 3,0,,,,
testuser1@domain.com,testgroup@domain.com,Test Group Org,0,,,,
$ gam user testuser1@domain.com print grouptree showparentsaslist delimiter "|"
User,Group,Name,ParentsCount,Parents,ParentsName
testuser1@domain.com,testgroup1@domain.com,Test Group1,1,testgroup@domain.com,Test Group Org
testuser1@domain.com,testgroup2@domain.com,Test - Group 2,2,testgroup1@domain.com|testgroup@domain.com,Test Group1|Test Group Org
testuser1@domain.com,testgroup2@domain.com,Test - Group 2,1,testgroup@domain.net,Test Group Net
testuser1@domain.com,testgroup3@domain.com,Test - Group 3,0,,
testuser1@domain.com,testgroup@domain.com,Test Group Org,0,,
$ gam user testuser1@domain.com print grouptree roles member,manager,owner
User,Group,Name,Role,parents,parents.0.email,parents.0.name,parents.1.email,parents.1.name
testuser1@domain.com,testgroup1@domain.com,Test Group1,MEMBER,1,testgroup@domain.com,Test Group Org,,
testuser1@domain.com,testgroup2@domain.com,Test - Group 2,MEMBER,2,testgroup1@domain.com,Test Group1,testgroup@domain.com,Test Group Org
testuser1@domain.com,testgroup2@domain.com,Test - Group 2,MEMBER,1,testgroup@domain.net,Test Group Net,,
testuser1@domain.com,testgroup3@domain.com,Test - Group 3,MANAGER,0,,,,
testuser1@domain.com,testgroup@domain.com,Test Group Org,MEMBER,0,,,,
$ gam user testuser1@domain.com print grouptree roles member,manager,owner showparentsaslist delimiter "|"
User,Group,Name,Role,ParentsCount,Parents,ParentsName
testuser1@domain.com,testgroup1@domain.com,Test Group1,MEMBER,1,testgroup@domain.com,Test Group Org
testuser1@domain.com,testgroup2@domain.com,Test - Group 2,MEMBER,2,testgroup1@domain.com|testgroup@domain.com,Test Group1|Test Group Org
testuser1@domain.com,testgroup2@domain.com,Test - Group 2,MEMBER,1,testgroup@domain.net,Test Group Net
testuser1@domain.com,testgroup3@domain.com,Test - Group 3,MANAGER,0,,
testuser1@domain.com,testgroup@domain.com,Test Group Org,MEMBER,0,,
$ gam user testuser1@domain.com print grouptree roles manager
User,Group,Name,Role,parents
testuser1@domain.com,testgroup3@domain.com,Test - Group 3,MANAGER,0
$ gam config csv_output_header_drop_filter "name,parents.*name" user testuser1@domain.com print grouptree
User,Group,parents,parents.0.email,parents.1.email
testuser1@domain.com,testgroup1@domain.com,1,testgroup@domain.com,
testuser1@domain.com,testgroup2@domain.com,2,testgroup1@domain.com,testgroup@domain.com
testuser1@domain.com,testgroup2@domain.com,1,testgroup@domain.net,
testuser1@domain.com,testgroup3@domain.com,0,,
testuser1@domain.com,testgroup@domain.com,0,,
Get the source user group information.
gam redirect csv ./SourceGroups.csv user sourceuser@domain.com print groups
Add the target user to the these groups with the same role and delivery settings.
gam csv ./SourceGroups.csv gam user targetuser@domain.com add group "~Role" delivery "~Delivery" "~Group"
Need more help? Ask on the GAM Discussion Group
Update History
Installation
- How to Install GAM7
- How to Upgrade GAMADV-XTD3 to GAM7
- How to Upgrade Legacy GAM to GAM7
- How to Update GAM7
- Verifying a GAM7 Build is Legitimate and Official
- Install GAM as Python Library
- GAM7 on Chrome OS Devices
- GAM7 on Android Devices
- Google Network Addresses
- HTTPS Proxy
- SSL Root CA Certificates
- How to Uninstall GAM7
Configuration
- Authorization
- GAM Configuration
- Running GAM7 securely on a Google Compute Engine
- Using GAM7 with a delegated admin service account
- Using GAM7 with a YubiKey
- GAM with minimal GCP rights
Notes and Information
- Upgrade Benefits
- Questions? Visit the GAM Discussion Forum
- GAM Public Chat Room
- Scripts
- Other Resources
- Drive REST API v3
- BNF Syntax
- GAM Return Codes
- Python Regular Expressions
- Rclone
Definitions
Command Processing
- Bulk Processing
- Command Line Parsing
- Command Logging and Progress
- Command data from Google Docs/Sheets/Storage
- CSV Special Characters
- CSV Input Filtering
- CSV Output Filtering
- Meta Commands and File Redirection
- Permission matches
- Tag Replace
- Todrive
Collections
Client Access
- Addresses
- Administrators
- Alert Center
- Aliases
- Calendars
- Calendars - Access
- Calendars - Events
- Chrome Auto Update Expiration Counts
- Chrome Browser Cloud Management
- Chrome Device Needs Attention Counts
- Chrome Installed Apps
- Chrome Policies
- Chrome Printers
- Chrome Profile Management
- Chrome Version Counts
- Chrome Version History
- ChromeOS Devices
- Classroom - Courses
- Classroom - Guardians
- Classroom - Invitations
- Classroom - Membership
- Cloud Channel
- Cloud Identity Devices
- Cloud Identity Groups
- Cloud Identity Groups - Membership
- Cloud Identity Policies
- Cloud Storage
- Context Aware Access Levels
- Customer
- Domains
- Domains - Verification
- Domain People - Contacts & Profiles
- Domain Shared Contacts - Global Address List
- Email Audit Monitor
- Find File Owner
- Google Data Transfers
- Groups
- Groups - Membership
- Inbound SSO
- Licenses
- Mobile Devices
- Organizational Units
- Reports
- Reseller
- Resources
- Send Email
- Schemas
- Shared Drives
- Sites
- Users
- Unmanaged Accounts
- Users - Signout and Turn off 2-Step Verification
- Vault - Takeout
- Version and Help
Special Service Account Access
Service Account Access
- Users - Analytics Admin
- Users - Application Specific Passwords
- Users - Backup Verification Codes
- Users - Calendars
- Users - Calendars - Access
- Users - Calendars - Events
- Users - Chat
- Users - Classification Labels
- Users - Classroom - Profile
- Users - Deprovision
- Users - Contacts
- Users - Contacts - Delegates
- Users - Drive - File Selection
- Users - Drive - Activity/Settings
- Users - Drive - Cleanup
- Users - Drive - Comments
- Users - Drive - Copy/Move
- Users - Drive - Files-Display
- Users - Drive - Files-Manage
- Users - Drive - Orphans
- Users - Drive - Ownership
- Users - Drive - Permissions
- Users - Drive - Query
- Users - Drive - Revisions
- Users - Drive - Shortcuts
- Users - Drive - Transfer
- Users - Forms
- Users - Gmail - Client Side Encryption
- Users - Gmail - Delegates
- Users - Gmail - Filters
- Users - Gmail - Forwarding
- Users - Gmail - Labels
- Users - Gmail - Messages/Threads
- Users - Gmail - Profile
- Users - Gmail - S/MIME
- Users - Gmail - SendAs/Signature/Vacation
- Users - Gmail - Settings
- Users - Group Membership
- Users - Keep
- Users - Looker Studio
- Users - Meet
- Users - Classroom - Profile
- Users - People - Contacts & Profiles
- Users - Photo
- Users - Profile Sharing
- Users - Shared Drives
- Users - Spreadsheets
- Users - Tasks
- Users - Tokens
- Users - YouTube
GAM Tutorials
- Account Auditing
- Calendar Settings
- Chat Bot commands
- Chrome Browser Management
- Chrome Policy Settings
- Context Aware Access levels
- Data Transfers
- Domain Verification
- Google Drive Management
- Group Settings
- Inbound SSO Settings
- Managing Admins
- Managing Classroom
- Managing Custom User Schemas
- Managing Devices
- Managing Organizations
- Managing Product Licenses
- Managing Users, Groups, Aliases, Domains, Mobile and Chrome Devices, and Resource Calendars
- OAuth Authentication Related Commands
- Print Users, Groups, Aliases, Mobile and Chrome OS devices, OUs, Licenses and Reports
- Printers
- Unmanaged Users and Invitations
- User Email Settings
- User Security Settings