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.
© Copyright 2020 Glen Pringle Version 1.6.3, 20
th
August, 2020
1
User Email
gam <who> <attributes/values>
where attributes and values are:
language <language code>
show language
pagesize 25|50|100
shortcuts|arrows|snippets|utf|webclips on|off
signature <signature text> |(file <signature file>
[charset <Charset>]) (replace <Tag> <String>)*
[name <String>] [replyto <EmailAddress>]
vacation on|off [subject <String> (message
<String>)|(file <FileName> [charset <CharSet>])
(replace <Tag> <String>)* [html] [contactsonly]
[domainonly][startdate <Date>] [enddate <Date>]]
[add] label <label name> [messagelistvisibility
hide|show] [labellistvisibility
hide|show|showifunread] [backgroundcolor
<color>] [textcolor <color>]
delete label <label name>|regex:<RegularExpression>
|--ALL_LABELS--
update label search <search> replace <replace> [merge]
update labelsettings <label name> name <new label
name> [message_list_visibility show|hide]
[label_list_visibility show|hide|show_if_unread]
show labels [onlyuser]
filter from <email address>|to <email address>|subject
<words>| haswords <words>| nowords
<words>|musthaveattachment| label <label
name>|markread|archive|star| forward <email
address>|trash|neverspam
delete|info filter <FilterIDEntity>
[add]|update sendas <email address> <name>
[default] [replyto <email address>] [treatasalias
<Boolean>] [signature <String>|(file <FileName>
[charset <CharSet>]) (replace <RegularExpression>
<String>)*]
delete sendas <email address>
info sendas <email address] [format]
on|off [for allmail|newmail|fromnowown] [action
keep|leaveininbox|archive|delete|trash|markread]
imap on|off [noautoexpunge] [expungebehavior
archive|deleteforever|trash] [maxfoldersize
0|1000|2000|5000|10000]
on|off [email address] [keep|archive|delete]
delegate to <user email>
add delegate|forwardingaddress <user email>
show delegates [csv]
show vacation|filters|imap|pop|forward|profile|
forwardingaddress
show sendas|vacation|signature [format]
print [todrive]
delete delegate|forwardingaddress <user email>
profile shared|unshared
update photo <photo filename>
get photo [drivedir|(targetfolder <FilePath>)] [noshow]
delete photo
print filters|forward|sendas [todrive]
gam user <who> sendemail|draftemail [message
<message>] [file <file>] [subject <subject] [recipient
<recipient>]
gam user <who> insertemail|importemail [message
<message>] [file <file>] [subject <subject] [recipient
<recipient>] [labels <labels,>]
gam user <who> delete|trash|untrash
messages|threads query <gmail search> [doit]
[maxto<action> <number>]
gam user <who> modify messages
addlabel|removelabel <label> query <gmail search>
[doit] [maxto<action> <number>]
where <action> is:
delete|trash|untrash|modify
e.g. maxtotrash, maxtountrash
Drive Management
gam <who> show filelist [todrive] [query <query>]
[allfields] [createddate] [description] [fileextension]
[filesize] [id] [restricted] [starred] [trashed] [viewed]
[lastmodifyingusername] [lastviewedbymedate]
[modifieddate] [originalfilename] [quotaused]
[shared] [writerscanshare]
gam <who> show driveactivity [todrive] [fileid <id>]
[folderid <id>]
gam <who> show drivesettings [todrive]
gam <who> show fileinfo <id>|[allfields|
<DriveFieldName>*]
gam <who> show filetree
gam <who> show filerevisions <id>
gam <who> add drivefile [localfile <filepath>]
[drivefilename <filename>] [convert] [ocr]
[ocrlanguage <language>] [returnidonly]
[copyrequireswriterpermission true|false] [restricted]
[starred] [trashed] [viewed] [lastviewedbyme
<date>] [modifieddate <date>] [description
<description> [mimetype <type>] [parentid <folder
id>] [parentname <folder name>] [writerscantshare]
gam <who> update drivefile [localfile <filepath>]
[newfilename <filename>] [id <drive file id> |
drivefilename <filename>] [convert] [ocr]
[ocrlanguage <language>]
[copyrequireswriterpermission true|false] [restricted
true|false] [starred true|false] [trashed true|false]
[viewed true|false] [lastviewedbyme <date>]
[modifieddate <date>] [description <description>]
[mimetype <type>] [parentid <folder id>]
[parentname <folder name>] [writerscantshare]
gam <who> get drivefile [id <file id> | query <query>]
[format <openoffice|microsoft|pdf>] [targetfolder
<local path>] [revision <number>]
gam <who> delete emptydrivefolders| drivefile <file
id> [purge]
gam <who> transfer drive <target user> [keepuser]
gam <who> empty drivetrash
ACLs
gam user <user email> show drivefileacl <file id>
[asadmin]
gam user <user email> add drivefileacl <file id>
[user|group|domain <value>|anyone] [withlink]
[role <aclrole>] [sendemail] [emailmessage
<message text>]
gam user <user email>update drivefileacl <file id>
<permission id> [withlink] [role <aclrole>]
[transferownership <true|false>] [asadmin]
gam user <user email>delete drivefileacl <file id>
<permission id> [asadmin]
where <aclrole> is:
commenter|contentmanager|editor|fileorganizer|
organizer|owner|reader|writer
Team Drive
gam user <email> add teamdrive <name>
gam user <email> update teamdrive <id> asadmin
[name <name>]
gam user <email> delete teamdrive <id>
gam user <email> print|show teamdrives [todrive]
[asadmin]
Users
gam create|update user <user email> [options]
gam <who> update user [options]
Common options:
[firstname <First Name>] [lastname <Last Name>]
[password <Password>] [email <New Email>]
[gal on|off] [suspended on|off] [sha] [md5] [crypt]
[nohash] [changepassword on|off] [org <Org Name>]
Extended options:
[relation <relation type> <relation value>]
[externalid <id type> <id value>]
[phone type <phone type> value <phone value>
primary|notprimary]
[organization name <org name> title <org title>
type <org type> department <org dept>
symbol <org symbol> costcenter <org cost center>
location <org location>description <org desc>
domain <org domain> primary|notprimary]
[address type <address type>
unstructured <unstructered address>
extendedaddress <address extended address>
streetaddress <address street address>
locality <address locality> region <address region>
postalcode <address postal code> pobox <address
pobox> countrycode <address country code>
primary|notprimary]
[im type <im type> protocol <im protocol> primary
<im value>]
[location type <location type> area <area> building
<building> desk <desk> floor <floor> section
<section> endlocation]
[sshkeys expires <date> key <keyvalue>]
[posixaccounts gecos <gecos> gid <numeric gid>
uid <numeric uid> home <home path>
primary true|false shell <shell> system <systemid>
username <username> os <ostype> endposix]
[agreedtoterms on|off]
[schemaname.fieldname <fieldvalue>]
[schemaname.multivaluefieldname multivalued
<fieldvalue>]
[recoveryemail <email>] [recoveryphone <phone>]
Extended options for update only:
[customerid <string>]
[otheremail home|work|other|<custom> <email
address>]
gam info user <user email> [nogroups] [noaliases]
[nolicenses] [noschemas] [schemas list,of,schemas]
[userview] [skus <list,of,skus>]
gam delete user <user email>
gam undelete user <user email> [org <org Name>]
gam <who> print
gam print users [allfields] [custom all|list,of,schemas]
[userview] [ims] [emails] [externalids] [relations]
[addresses] [organizations] [phones] [licenses]
[photo] [firstname] [lastname] [emailparts]
[deleted_only] [id] [orderby
email|firstname|lastname] [query <query>]
[ascending|descending] [domain <Domain Name>]
[fullname] [ou] [suspended] [changepassword] [gal]
[agreed2terms] [admin] [creationtime] [aliases]
[lastlogintime] [groups] [ismailboxsetup] [todrive]
gam <who> show gmailprofile [todrive]
Calendars
gam calendar <cal email>|id:<cal id>
<action> [<options>]
where <action> and <options> are:
showacl|wipe
add|update freebusy|read|editor|owner <user
email>|user <user email>|group <group
email>|domain [<Domain name>]|default
delete <user email>|user <user email>|group <group
email>|domain [<Domain name>]|default
delete [user <user email>] [id <ACL id>]
addevent [attendee <user email>] [location <location>]
[optionalattendee <user email>] [anyonecanaddself]
[summary <summary>] [source <title> <url>]
[description <event description>] [id <id>]
[available] start allday <YYYY-MM-DD>|<start
datetime> end allday <YYYY-MM-DD>|<end
datetime> [guestscantinviteothers]
[guestscantseeothers] [hangoutsmeet] [visibility
default|public|private] [tentative] [notifyattendees]
[recurrence <repeat>] [noreminders]|[reminder
<minutes> email|popup|sms] [timezone <timezone]
[privateproperty <Key> <Value>] [sharedproperty
<Key> <Value>] [colorindex <index>]
updateevent eventid <id> <options> where <options>
are as p er add eve nt ab o ve
deleteevent [eventid <id>] [query <query>]
[notifyattendees] [doit]
gam <who> show calendars|calsettings
gam <who> delete calendar <calendar email>
gam <who> add | update calendar <calendar email>
[selected true|false] [hidden true|false] [reminder
email|sms|popup (minutes)] [summary <summary>]
[colorindex (1-24)] [backgroundcolor <htmlcolor>]
[foregroundcolor <htmlcolor>]
gam <who> update calattendees csv <csv file> [start
YYYY-MM-DD] [end YYYY-MM-DD] [allevents]
[dryrun]
gam <who> transfer seccals <target user> [keepuser]
gam <who> info calendar <calendar email>|primary
gam <who> print calendars [todrive]
Calendar Resources
gam create resource <id> <Name> [parameters]
gam update resource <id> [name <Name>]
[parameters]
where parameters are:
[description <description>] [type <type>] [building
<building>] [capacity <number>] [features
<features>] [floor <floor>] [floorsection
<floorsection>]
gam info|delete resource <id>
gam print resources [id] [description] [email] [type]
[allfields] [todrive]
gam create building <name> [id <id>] [latitude
<latitude>] [longitude <longitude>] [description
<description>] [floors <floors>]
gam update building <name or id:id> [name <name>]
[latitude <latitude>] [longitude <longitude>]
[description <description>] [floors <floors>]
gam info building <name or id:id>
gam delete building <name or id:id>
gam create feature name <name>
gam update feature <name> name <newname>
gam delete feature <name>
GAM Cheat Sheet
github.com/jay0lee/GAM for GAM 5.11