Added a command to update a Gmail label's settings by specifying it's ID rather than it's name.

This commit is contained in:
Ross Scroggs
2024-03-11 16:41:47 -07:00
parent be0eff7e14
commit abe1d5381d
7 changed files with 69 additions and 10 deletions

View File

@ -10,7 +10,16 @@ Add the `-s` option to the end of the above commands to suppress creating the `g
See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation
### 6.71.23
### 6.71.14
Added a command to update a Gmail label's settings by specifying it's ID rather than it's name.
```
gam <UserTypeEntity> update labelid <LabelID> [name <String>]
[messagelistvisibility hide|show] [labellistvisibility hide|show|showifunread]
[backgroundcolor <LabelColorHex>] [textcolor <LabelColorHex>]
```
### 6.71.13
Updated `<UserMultiAttribute>.location.buildingid <String>` to allow non-validated building IDs
by specifying `nv:` at the beginning of `<String>`; e.g., `nv:Building X' sets the building ID to `Building X`.

View File

@ -334,7 +334,7 @@ writes the credentials into the file oauth2.txt.
admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt
admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version
WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
GAMADV-XTD3 6.71.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.71.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.2 64-bit final
MacOS Sonoma 14.2.1 x86_64
@ -1006,7 +1006,7 @@ writes the credentials into the file oauth2.txt.
C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt
C:\GAMADV-XTD3>gam version
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
GAMADV-XTD3 6.71.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.71.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.2 64-bit final
Windows-10-10.0.17134 AMD64

View File

@ -88,11 +88,17 @@ all parent labels are created as necessary.
Example: `gam user user@domain.com add label "Top/Middle/Bottom" buildpath`
## Update a label's settings
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.

View File

@ -3,7 +3,7 @@
Print the current version of Gam with details
```
gam version
GAMADV-XTD3 6.71.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.71.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.2 64-bit final
MacOS Sonoma 14.2.1 x86_64
@ -15,7 +15,7 @@ Time: 2023-06-02T21:10:00-07:00
Print the current version of Gam with details and time offset information
```
gam version timeoffset
GAMADV-XTD3 6.71.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.71.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.2 64-bit final
MacOS Sonoma 14.2.1 x86_64
@ -27,7 +27,7 @@ Your system time differs from www.googleapis.com by less than 1 second
Print the current version of Gam with extended details and SSL information
```
gam version extended
GAMADV-XTD3 6.71.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.71.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.2 64-bit final
MacOS Sonoma 14.2.1 x86_64
@ -64,7 +64,7 @@ MacOS High Sierra 10.13.6 x86_64
Path: /Users/Admin/bin/gamadv-xtd3
Version Check:
Current: 5.35.08
Latest: 6.71.13
Latest: 6.71.14
echo $?
1
```
@ -72,7 +72,7 @@ echo $?
Print the current version number without details
```
gam version simple
6.71.13
6.71.14
```
In Linux/MacOS you can do:
```
@ -82,7 +82,7 @@ echo $VER
Print the current version of Gam and address of this Wiki
```
gam help
GAM 6.71.13 - https://github.com/taers232c/GAMADV-XTD3
GAM 6.71.14 - https://github.com/taers232c/GAMADV-XTD3
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.2 64-bit final
MacOS Sonoma 14.2.1 x86_64

View File

@ -6940,6 +6940,10 @@ gam <UserTypeEntity> create labellist <LabelNameEntity>
[backgroundcolor "<LabelColorHex>|<LabelBackgroundColorHex>|custom:<ColorHex>"]
[textcolor "<LabelColorHex>|<LabelTextColorHex>|custom:<ColorHex>"]
[buildpath [<Boolean>]]
gam <UserTypeEntity> update labelid <LabelID> [name <String>]
[messagelistvisibility hide|show] [labellistvisibility hide|show|showifunread]
[backgroundcolor "<LabelColorHex>|<LabelBackgroundColorHex>|custom:<ColorHex>"]
[textcolor "<LabelColorHex>|<LabelTextColorHex>|custom:<ColorHex>"]
gam <UserTypeEntity> update labelsettings <LabelName> [name <String>]
[messagelistvisibility hide|show] [labellistvisibility hide|show|showifunread]
[backgroundcolor "<LabelColorHex>|<LabelBackgroundColorHex>|custom:<ColorHex>"]

View File

@ -2,7 +2,17 @@
Merged GAM-Team version
6.71.23
6.71.14
Added a command to update a Gmail label's settings by specifying it's ID rather than it's name.
```
gam <UserTypeEntity> update labelid <LabelID> [name <String>]
[messagelistvisibility hide|show] [labellistvisibility hide|show|showifunread]
[backgroundcolor "<LabelColorHex>|<LabelBackgroundColorHex>|custom:<ColorHex>"]
[textcolor "<LabelColorHex>|<LabelTextColorHex>|custom:<ColorHex>"]
```
6.71.13
Updated `<UserMultiAttribute>.location.buildingid <String>` to allow non-validated building IDs
by specifying `nv:` at the beginning of `<String>`; e.g., `nv:Building X' sets the building ID to `Building X`.

View File

@ -65955,6 +65955,35 @@ def updateLabelSettings(users):
entityActionFailedWarning([Ent.USER, user, Ent.LABEL, label_name], str(e), i, count)
except (GAPI.serviceNotAvailable, GAPI.badRequest):
entityServiceNotApplicableWarning(Ent.USER, user, i, count)
# gam <UserTypeEntity> update labelid <LabelID> [name <String>]
# [messagelistvisibility hide|show] [labellistvisibility hide|show|showifunread]
# [backgroundcolor <LabelColorHex>] [textcolor <LabelColorHex>]
def updateLabelSettingsById(users):
labelId = getString(Cmd.OB_LABEL_ID)
body = {}
while Cmd.ArgumentsRemaining():
myarg = getArgument()
if myarg == 'name':
body['name'] = getString(Cmd.OB_STRING)
else:
getLabelAttributes(myarg, body)
checkLabelColor(body)
i, count, users = getEntityArgument(users)
for user in users:
i += 1
user, gmail = buildGAPIServiceObject(API.GMAIL, user, i, count)
if not gmail:
continue
try:
result = callGAPI(gmail.users().labels(), 'patch',
throwReasons=GAPI.GMAIL_THROW_REASONS+[GAPI.NOT_FOUND, GAPI.INVALID_ARGUMENT],
userId='me', id=labelId, body=body, fields='name')
entityActionPerformed([Ent.USER, user, Ent.LABEL_ID, labelId, Ent.LABEL, result['name']], i, count)
except (GAPI.notFound, GAPI.invalidArgument) as e:
entityActionFailedWarning([Ent.USER, user, Ent.LABEL_ID, labelId], str(e), i, count)
except (GAPI.serviceNotAvailable, GAPI.badRequest):
entityServiceNotApplicableWarning(Ent.USER, user, i, count)
#
def cleanLabelQuery(labelQuery):
for ch in '/ (){}':
@ -73762,6 +73791,7 @@ USER_COMMANDS_WITH_OBJECTS = {
Cmd.ARG_FORM: updateForm,
Cmd.ARG_GROUP: updateUserGroups,
Cmd.ARG_LABEL: updateLabels,
Cmd.ARG_LABELID: updateLabelSettingsById,
Cmd.ARG_LABELSETTINGS: updateLabelSettings,
Cmd.ARG_LICENSE: updateLicense,
Cmd.ARG_OTHERCONTACT: processUserPeopleOtherContacts,