-
Notifications
You must be signed in to change notification settings - Fork 473
Users Gmail Labels
- API documentation
- Python Regular Expressions Match function
- Definitions
- Special quoting
- Add a label
- Update a label's settings
- Change label names
- Delete labels
- Display labels
<ColorHex> ::= "#<Hex><Hex><Hex><Hex><Hex><Hex>"
<LabelColorHex> ::=
#000000|#076239|#0b804b|#149e60|#16a766|#1a764d|#1c4587|#285bac|
#2a9c68|#3c78d8|#3dc789|#41236d|#434343|#43d692|#44b984|#4a86e8|
#653e9b|#666666|#68dfa9|#6d9eeb|#822111|#83334c|#89d3b2|#8e63ce|
#999999|#a0eac9|#a46a21|#a479e2|#a4c2f4|#aa8831|#ac2b16|#b65775|
#b694e8|#b9e4d0|#c6f3de|#c9daf8|#cc3a21|#cccccc|#cf8933|#d0bcf1|
#d5ae49|#e07798|#e4d7f5|#e66550|#eaa041|#efa093|#efefef|#f2c960|
#f3f3f3|#f691b3|#f6c5be|#f7a7c0|#fad165|#fb4c2f|#fbc8d9|#fcda83|
#fcdee8|#fce8b3|#fef1d1|#ffad47|#ffbc6b|#ffd6a2|#ffe6c7|#ffffff
<LabelBackgroundColorHex> ::=
#16a765|#2da2bb|#42d692|#4986e7|#98d7e4|#a2dcc1|
#b3efd3|#b6cff5|#b99aff|#c2c2c2|#cca6ac|#e3d7ff|
#e7e7e7|#ebdbde|#f2b2a8|#f691b2|#fb4c2f|#fbd3e0|
#fbe983|#fdedc1|#ff7537|#ffad46|#ffc8af|#ffdeb5
<LabelTextColorHex> ::=
#04502e|#094228|#0b4f30|#0d3472|#0d3b44|#3d188e|
#464646|#594c05|#662e37|#684e07|#711a36|#7a2e0b|
#7a4706|#8a1c0a|#994a64|#ffffff
<LabelID> ::= Label_<String>
<LabelIDList> ::= "<LabelID>(,<LabelID)*"
<LabelIDEntity> ::=
<LabelIDList> | <FileSelector> | <CSVFileSelector> | <CSVkmdSelector> | <CSVDataSelector>
See: https://github.com/GAM-team/GAM/wiki/Collections-of-Items
<LabelName> ::= <String>
<LabelNameList> ::= "'<LabelName>'(,'<LabelName>')*"
<LabelNameEntity> ::=
<LabelNameList> | <FileSelector> | <CSVFileSelector> | <CSVkmdSelector> | <CSVDataSelector>
See: https://github.com/GAM-team/GAM/wiki/Collections-of-Items
You specify a single label name with label <LabelName>
and a list of labels with labellist <LabelNameList>
.
As label names can contain spaces, some care must be used when entering <LabelName>
and <LabelNametList>
.
Suppose you have a label Foo Bar
. To delete it you enter the command: gam user [email protected] delete label "Foo Bar"
The shell strips the "
leaving a single argument Foo Bar
; gam correctly processes the argument.
Suppose you enter the command: gam user [email protected] delete labellist "Foo Bar"
The shell strips the "
leaving a single argument Foo Bar
; gam splits the argument on space leaving two items and then tries to process Foo
and Bar
, not what you want.
You must enter: gam user [email protected] delete labellist "'Foo Bar'"
The shell strips the "
leaving a single argument 'Foo Bar'
; gam splits the argument on space while honoring the '
leaving one item Foo Bar
and correctly processes the item.
See: List Items
gam <UserTypeEntity> [add] label|labels <LabelName>
[messagelistvisibility hide|show] [labellistvisibility hide|show|showifunread]
[backgroundcolor "<LabelColorHex>|<LabelBackgroundColorHex>|custom:<ColorHex>"]
[textcolor "<LabelColorHex>|<LabelTextColorHex>|custom:<ColorHex>"]
[buildpath [<Boolean>]]
gam <UserTypeEntity> create labellist <LabelNameEntity>
[messagelistvisibility hide|show] [labellistvisibility hide|show|showifunread] [buildpath [<Boolean>]]
[backgroundcolor "<LabelColorHex>|<LabelBackgroundColorHex>|custom:<ColorHex>"]
[textcolor "<LabelColorHex>|<LabelTextColorHex>|custom:<ColorHex>"]
[buildpath [<Boolean>]]
<LabelColorHex>
values should be enclosed in " to keep the command shell on MacOS and Linux from mis-interpreting them.
In Gmail, you can have a multi-level label like Top/Middle/Bottom
; you can also have a single-level label like Top/Middle/Bottom
,
- If
buildpath
is omitted or<Boolean>
is set to False, labels containing/
will be created as single-level. - If
buildpath
is present and<Boolean>
is omitted or set to True, labels containing/
will be created as multi-level; all parent labels are created as necessary.
Example: gam user [email protected] add label "Top/Middle/Bottom" buildpath
The two commands are equivalent; in the first you specify a <LabelName>
, in the second you specify a <LabelId>
.
gam <UserTypeEntity> update labelsettings <LabelName> [name <String>]
[messagelistvisibility hide|show] [labellistvisibility hide|show|showifunread]
[backgroundcolor "<LabelColorHex>|<LabelBackgroundColorHex>|custom:<ColorHex>"]
[textcolor "<LabelColorHex>|<LabelTextColorHex>|custom:<ColorHex>"]
gam <UserTypeEntity> update labelid <LabelID> [name <String>]
[messagelistvisibility hide|show] [labellistvisibility hide|show|showifunread]
[backgroundcolor "<LabelColorHex>|<LabelBackgroundColorHex>|custom:<ColorHex>"]
[textcolor "<LabelColorHex>|<LabelTextColorHex>|custom:<ColorHex>"]
<LabelColorHex>
values should be enclosed in " to keep the command shell on MacOS and Linux from mis-interpreting them.
gam <UserTypeEntity> update label|labels
[search <RegularExpression>] [replace <LabelReplacement>] [merge [keepoldlabel]]
At it's simplest, <RegularExpression>
is the old label name, and <LabelReplacement>
is the new label name.
To change the label "Foo" to a new label "Bar" (the label "Bar" must not already exist):
gam user [email protected] update label search "Foo" replace "Bar"
If there is any chance that "Foo" may appear in the middle of a label, you can anchor the search <RegularExpressions>
with ^
and $
so that only "Foo" exactly matches.
gam user [email protected] update label search "^Foo$" replace "Bar"
To change the label "Foo" to an existing label "Bar", use the merge option. If you want to keep "Foo" after the merge,
use the keepoldlabel
option; otherwise, it will be deleted which may not be desirable.
gam user [email protected] update label search "^Foo$" replace "Bar" merge keepoldlabel
If you want to use part of an old label name in the new label name, you isolate the portion of the old label name you want to keep
and indicate in the new label name where the isolated portion goes. In search <RegularExpression>
there should be at least one instance of a
parenthesized expression, e.g., (.*)
. In replace <LabelReplacement>
, \1
, \2
, ... indicate where the isolated portions go.
gam user [email protected] update label search "^INBOX/(.*)$" replace "O365/\1"
gam <UserTypeEntity> delete|del label|labels <LabelName>|regex:<RegularExpression>|--ALL_LABELS--
gam <UserTypeEntity> delete labelid <LabelID>
gam <UserTypeEntity> delete labellist <LabelNameEntity>
gam <UserTypeEntity> delete labelidlist <LabelIDEntity>
gam <UserTypeEntity> show labels|label
[useronly|onlyuser [<Boolean>]] [showcounts [<Boolean>]]
[nested [<Boolean>]] [display allfields|basename|fullname]
[labellist <LabelNameEntity>]
gam <UserTypeEntity> print labels|label [todrive <ToDriveAttribute>*]
[useronly|onlyuser [<Boolean>]] [showcounts [<Boolean>]]
[labellist <LabelNameEntity>]
By default, all labels, user and system are displayed.
-
useronly|onlyuser
- Do not display system labels. -
labellist <LabelNameEntity>
- Display selected labels -
showCounts
- The fields: messagesTotal, messagesUnread, threadsTotal and threadsUnread are displayed in addition to other fields. -
nested
- This causes nested labels to be indented under their parent label to allow the hierarchy to be more clearly visible. -
If
display
is not specified ordisplay allfields
is specified, the full name of the label and the fields (type, id, labelListVisibility, messageListVisibility) are displayed. -
If
display fullname
is specified, the full name of the label, and no other fields, is displayed. -
If
display basename
is specified, the base name (rightmost component) of the label, and no other fields, is displayed. Thedisplay fullname/basename
options are most useful in conjunction with nested.
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
- 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
Notes and Information
- Upgrade Benefits
- Questions? Visit the GAM Discussion Forum
- 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 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
- Managing Users, Groups, Aliases, Domains, Mobile and Chrome Devices, and Resource Calendars
- Group Settings
- Data Transfers
- Print Users, Groups, Aliases, Mobile and Chrome OS devices, OUs, Licenses and Reports
- Managing Custom User Schemas
- User Email Settings
- User Security Settings
- Managing Classroom
- Managing Devices
- Chrome Policy Settings
- Chrome Browser Management
- Calendar Settings
- Unmanaged Users and Invitations
- Google Drive Management
- Inbound SSO Settings
- Managing Admins
- Domain Verification
- Printers