
gam <who>spam messages|threads (((query
<QueryGmail>) (matchlabel <LabelName>) [or|and])+
[quick|notquick] [doit] [max_to_spam|max_to_process
<Number>])|(ids <MessageIDEntity>)
gam <who>show messages|threads (((query
<QueryGmail>) (matchlabel <LabelName>) [or|and])*
[quick|notquick] [max_to_show|max_to_process
<Number>] [includespamtrash])|
(ids <MessageIDEntity>) [headers <String>]
[showlabels] [showsize] [showsnippet]
gam <who>print messages|threads (((query
<QueryGmail>) (matchlabel <LabelName>) [or|and])*
[quick|notquick] [max_to_print|max_to_process
<Number>] [includespamtrash])|
(ids <MessageIDEntity>) [headers <String>]
[showlabels] [showsize] [showsnippet] [todrive] [idfirst]
Users
Version 0.1, 11th January, 20171
Advanced GAM Cheat Sheet
File Redirection
gam [<Select>] [<Config>] [<Redirect>] [any gam cmd]
<Redirect> is:
redirect csv <FileName> [multiprocess] [append]
[noheader] [charset <Charset>]
[columndelimiter <Character>] |
redirect stdout <FileName> [append] |
redirect stderr <FileName> [append]
Calendar ACLs, Events
gam calendar <calendar email> <action> [<options>]
where action and options are:
update event <EventIDEntity> <EventAttributes>+
move event <EventIDEntity> to <CalendarItem>
show|wipe events
add|update acl <CalendarACLRole> <ACLScope>
del acl [<CalendarACLRole>] <ACLScope>
info acl <ACLScopeEntity>
show acls
Audit
gam audit uploadkey <ValueReadFromStdin>
gam audit activity request <EmailAddress>
gam audit activity delete <EmailAddress> <RequestID>
gam audit activity download <EmailAddress>
<RequestID>
gam audit activity status [<EmailAddress> <RequestID>]
gam audit export request <EmailAddress>
[begin <DateTime>] [end <DateTime>]
[search <QueryGmail>] [headersonly] [includedeleted]
gam audit export delete <EmailAddress> <RequestID>
gam audit export download <EmailAddress>
<RequestID>
gam audit export status [<EmailAddress> <RequestID>]
gam audit export watch <EmailAddress> <RequestID>
gam audit monitor create <EmailAddress>
<DestEmailAddress> [begin <DateTime>]
[end <DateTime>] [incoming_headers]
[outgoing_headers] [nochats] [nodrafts]
[chat_headers] [draft_headers]
gam audit monitor delete <EmailAddress>
<DestEmailAddress>
gam audit monitor list <EmailAddress>
gam list [todrive [<ToDriveAttributes>]] <EntityList>
[data <CrOSTypeEntity>|
<UserTypeEntity> [delimiter <String>]]
gam <CrOSTypeEntity>|<UserTypeEntity> list
[todrive [<ToDriveAttributes>]]
[data <EntityList> [delimiter <String>]]
gam <UserTypeEntity> check serviceaccount
Chrome Devices
gam create contact <ContactAttributes>+
gam update contacts <ContactEntity>
<ContactAttributes>+
gam delete contacts <ContactEntity>|
([query <QueryContact>] [emailmatchpattern
<RegularExpression>]
[emailmatchtype work|home|other|<String>]
[updated_min yyyy-mm-dd]
gam info contacts <ContactEntity> [basic|full]
[showgroups] [fields <ContactFieldNameList>]
gam <who> show contacts [query <QueryContact>]
[emailmatchpattern <RegularExpression>]
[emailmatchtype work|home|other|<String>]
[updated_min yyyy-mm-dd] [basic|full] [showgroups]
[orderby <ContactOrderByFieldName>
[ascending|descending]]
[showdeleted] [fields <ContactFieldNameList>]
gam print contacts [todrive] [query <QueryContact>]
[emailmatchpattern <RegularExpression>]
[emailmatchtype work|home|other|<String>]
[updated_min yyyy-mm-dd] [basic|full] [showgroups]
[orderby <ContactOrderByFieldName>
[ascending|descending]]
[showdeleted] [fields <ContactFieldNameList>]
gam <who> create contactgroup
<ContactGroupAttributes>+
gam <who> update contactgroup
<ContactGroupItem> <ContactGroupAttributes>+
gam <who> delete contactgroups
<ContactGroupEntity>
gam <who> info contactgroups
<ContactGroupEntity>
gam <who> show contactgroups
[updated_min yyyy-mm-dd]
[basic|full] [showdeleted]
[orderby <ContactOrderByFieldName>
[ascending|descending]]
gam <who> print contactgroups [todrive]
[updated_min yyyy-mm-dd] [basic|full] [showdeleted]
[orderby <ContactOrderByFieldName>
[ascending|descending]]
Contacts
Bulk Operations
gam csv <FileName>|- [charset <Charset>]
[columndelimiter <String>] [fields <FieldNameList>]
(matchfield <FieldName> <RegularExpression>)*
gam <GAMArgumentList>
gam update instance sso_settings [enabled <Boolean>]
[sign_on_uri <URI>] [sign_out_uri <URI>]
[password_uri <URI>] [whitelist <CIDRnetmask>]
[use_domain_specific_issuer <Boolean>]
gam update instance sso_key <FileName>
gam update instance logo <FileName>
gam info instance [logo <FileName>]
Domain Settings
Sites
gam [<who>] create site <SiteItem> <SiteAttributes>*
gam [<who>] update sites <SiteEntity> <SiteAttributes>+
gam [<who>] info sites <SiteEntity> [withmappings]
[role|roles all|<SiteACLRoleList>]
gam [<who>] show sites [domain|domains
<DomainNameEntity>] [includeallsites]
[withmappings] [role|roles all|<SiteACLRoleList>]
[maxresults <Number>]
gam [<who>] print sites [todrive [<ToDriveAttributes>]]
[domain|domains <DomainNameEntity>]
[includeallsites] [withmappings] [role|roles all|
<SiteACLRoleList>] [maxresults <Number>]
[convertcrnl] [delimiter <String>]
gam [<who>] print siteactivity <SiteEntity>
[todrive [<ToDriveAttributes>]] [maxresults <Number>]
[updated_min yyyy-mm-dd] [updated_max yyyy-mm-dd]
gam [<who>] add|update siteacls
<SiteEntity> <SiteACLRole> <ACLScopeEntity>
gam [<who>] delete|info siteacls
<SiteEntity> <ACLScopeEntity>
gam [<who>] show siteacls <SiteEntity>
User Drive Management
gam <who> show filetree [anyowner|(showownedby any|
me|others)] [select <DriveFileEntity>|orphans]
[depth <Number>] (orderby <DriveOrderByFieldName>
[ascending|descending])*
gam <who> print|show filelist [todrive
[<ToDriveAttributes>]] [anyowner|(showownedby any|
me|others)] [query <QueryDriveFile>]
[fullquery <QueryDriveFile>] [select <DriveFileEntity>|
orphans] [depth <Number>] [filepath] [allfields|
<DriveFieldName>*] (orderby <DriveOrderByFieldName>
[ascending|descending])* [delimiter <String>]
gam <who> print|show driveactivity [todrive
[<ToDriveAttributes>]] [fileid <DriveFileID>]
[folderid <DriveFolderID>]
gam <who> print|show drivesettings
[todrive [<ToDriveAttributes>]]
gam <who> delete|del emptydrivefolders
gam <who> purge drivefile <DriveFileEntity>
gam <who> trash drivefile <DriveFileEntity>
gam <who> untrash drivefile <DriveFileEntity>
gam <who> copy drivefile <DriveFileEntity> [newfilename
<DriveFileName>] [recursive] [parentid <DriveFolderID>]
[parentname <DriveFolderName>]
gam <who> show filepath <DriveFileEntity>
ACLs
gam <who> add drivefileacl <DriveFileEntity>
anyone|(user <UserItem>)|(group <GroupItem>)|
(domain <DomainName>) (role <DriveFileACLRole>)
[withlink|(allowfilediscovery <Boolean>)]
[expiration <Time>] [sendmail] [emailmessage <String>]
[showtitles]
gam <who> update drivefileacl <DriveFileEntity>
<DriveFilePermissionIDorEmail> (role <DriveFileACLRole>)
[withlink|(allowfilediscovery <Boolean>)]
[expiration <Time>] [removeexpiration <Boolean>]
[transferownership <Boolean>] [showtitles]
gam <who> delete drivefileacl <DriveFileEntity>
<DriveFilePermissionIDorEmail> [showtitles]
gam <who> show drivefileacl <DriveFileEntity> [showtitles]
gam <who> add permissions <DriveFileEntity>
<DriveFilePermissionEntity> [expiration <Time>]
[sendmail] [emailmessage <String>]
gam <who> delete permissions <DriveFileEntity>
<DriveFilePermissionIDEntity>
gam <who> transfer ownership <DriveFileEntity>
<UserItem> [includetrashed]
(orderby <DriveOrderByFieldName>
[ascending|descending])* [preview] [filepath]
[todrive [<ToDriveAttributes>]]
gam <who> claim ownership <DriveFileEntity>
[skipids <DriveFileEntity>] [skipusers <UserTypeEntity>]
[subdomains <DomainNameEntity>] [includetrashed]
[writerscantshare] [preview] [filepath]
[todrive [<ToDriveAttributes>]]
gam <who> deprovision
User Email
https://github.com/taers232c/GAMADV-X GAMADV-X 4.39.14 vs GAM 4.03
DISCLAIMER: This is a reference sheet for people familiar with GAM and is provided “as-is”. You use it at your own risk! Always test commands before running them in a production environment.
https://gamcheatsheet.com/ gam@gamcheatsheet.com
This sheet lists additional commands that appear in
Ross Scroggs’ advanced/extended version of GAM when
compared to the normal version of GAM.