Add csv option to `gam <UserTypeEntity> create chatspace

This commit is contained in:
Ross Scroggs
2026-04-01 17:10:20 -07:00
parent 56bdca9d41
commit 63b0d9ae5f
4 changed files with 56 additions and 13 deletions

View File

@@ -10,6 +10,14 @@ Add the `-s` option to the end of the above commands to suppress creating the `g
See [Downloads-Installs-GAM7](https://github.com/GAM-team/GAM/wiki/Downloads-Installs) for Windows or other options, including manual installation
### 7.39.03
Added the following options to `gam <UserTypeEntity> create chatspace` that can be used to capture
space details when creating chat spaces in bulk.
```
csv [todrive <ToDriveAttribute>*] [formatjson [quotechar <Character>]] (addcsvdata <FieldName> <String>)*
```
### 7.39.02
Fixed progress messages for `gam <UserTypeEntity> print filelist` when permissions were being

View File

@@ -251,7 +251,7 @@ writes the credentials into the file oauth2.txt.
```
gamteam@server:/Users/gamteam$ rm -f /Users/gamteam/GAMConfig/oauth2.txt
gamteam@server:/Users/gamteam$ gam version
GAM 7.39.02 - https://github.com/GAM-team/GAM - pyinstaller
GAM 7.39.03 - https://github.com/GAM-team/GAM - pyinstaller
GAM Team <google-apps-manager@googlegroups.com>
Python 3.14.3 64-bit final
macOS Tahoe 26.3.1 arm64
@@ -1034,7 +1034,7 @@ writes the credentials into the file oauth2.txt.
```
C:\>del C:\GAMConfig\oauth2.txt
C:\>gam version
GAM 7.39.02 - https://github.com/GAM-team/GAM - pythonsource
GAM 7.39.03 - https://github.com/GAM-team/GAM - pythonsource
GAM Team <google-apps-manager@googlegroups.com>
Python 3.14.3 64-bit final
Windows 11 10.0.26200 AMD64

View File

@@ -211,16 +211,14 @@ gam <UserTypeEntity> create chatspace
[members <UserTypeEntity>]
[displayname <String>]
[description <String>] [guidelines <String>]
[history <Boolean>]
[<ChatContent>]
[formatjson|returnidonly]
```
For `type space`, the following apply:
* `members <UserTypeEntity>` - Optional, can not specify more that 20 users
* `members <UserTypeEntity>` - Optional, can not specify more than 20 users
* `displayname <String>` - Required
* `description <String>` - Optional
* `guidelines <String>` - Optional
* `history <Boolean>` - Optional
* `announcement|collaboration` - Initial permission settings; default is `collaboration`
For `type groupchat`, the following apply:
@@ -228,23 +226,60 @@ For `type groupchat`, the following apply:
* `displayname <String>` - Ignored
* `description <String>` - Optional
* `guidelines <String>` - Optional
* `history <Boolean>` - Optional
For `type directmessage`, the following apply:
* `members <UserTypeEntity>` - Required, must specify 1 user
* `displayname <String>` - Ignored
* `description <String>` - Ignored
* `guidelines <String>` - Ignored
* `history <Boolean>` - Optional
By default, Gam displays the information about the created chatspace as an indented list of keys and values.
* `formatjson` - Display the fields in JSON format.
* `returnidonly` - Display the chatspace name only
Alternately, you can display the information about the created chatspace as columns of fields.
* `csv [todrive <ToDriveAttribute>*]` - Write Chat Space information to a CSV file.
* `addcsvdata <FieldName> <String>` - Add additional columns of data from the command line to the output
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.
When using the `formatjson` option, double quotes are used extensively in the data resulting in hard to read/process output.
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.
Use the `<ChatContent>` option to send an initial message to the created chatspace.
By default, details about the chatmessage are displayed.
* `formatjson` - Display the chat message name in JSON format.
* `returnidonly` - Display the chatmessage name only
* `csv` - The column `message.name` is added the CSV file output
### Bulk build chat spaces
You want to create Chat Spaces for use by users that don't currently have Chat enabled;
all commands will be run by a super admin.
Make a CSV file NewSpaces.csv with columns: displayName,manager,members
```
displayName,manager,members
Chat 123,user1@domain.com,user1@domain.com user2@domain.com user3@domain.com
Chat 456,user4@domain.com,user4@domain.com user5@domain.com user6@domain.com
```
The manager column specifies the member that will be updated to be a manager.
Create the spaces
```
gam redirect csv ./NewSpaceDetails.csv multiprocess csv NewSpaces.csv gam user admin@domain.com create chatspace type space collaboration displayname "~displayName" members "~members" csv addcsvdata manager "~manager"
```
Update the specified member from ROLE_MEMBER to ROLE_MANAGER
```
gam redirect stdout ./UpdateMemberToManager.txt multiprocess redirect stderr stdout csv NewSpaceDetails.csv gam user admin@domain.com update chatmember "~name" role manager user "~manager"
```
Delete the super admin from the space
```
gam redirect stdout ./DeleteAdmin.txt multiprocess redirect stderr stdout csv NewSpaceDetails.csv gam user admin@domain.com delete chatmember "~name" user admin@domain.com
```
### Update a user's chat space
```

View File

@@ -3,7 +3,7 @@
Print the current version of Gam with details
```
gam version
GAM 7.39.02 - https://github.com/GAM-team/GAM - pyinstaller
GAM 7.39.03 - https://github.com/GAM-team/GAM - pyinstaller
GAM Team <google-apps-manager@googlegroups.com>
Python 3.14.3 64-bit final
macOS Tahoe 26.3.1 arm64
@@ -15,7 +15,7 @@ Time: 2026-02-15T07:51:00-08:00
Print the current version of Gam with details and time offset information
```
gam version timeoffset
GAM 7.39.02 - https://github.com/GAM-team/GAM - pyinstaller
GAM 7.39.03 - https://github.com/GAM-team/GAM - pyinstaller
GAM Team <google-apps-manager@googlegroups.com>
Python 3.14.3 64-bit final
macOS Tahoe 26.3.1 arm64
@@ -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
GAM 7.39.02 - https://github.com/GAM-team/GAM - pyinstaller
GAM 7.39.03 - https://github.com/GAM-team/GAM - pyinstaller
GAM Team <google-apps-manager@googlegroups.com>
Python 3.14.3 64-bit final
macOS Tahoe 26.3.1 arm64
@@ -68,7 +68,7 @@ MacOS High Sierra 10.13.6 x86_64
Path: /Users/gamteam/bin/gam7
Version Check:
Current: 5.35.08
Latest: 7.39.02
Latest: 7.39.03
echo $?
1
```
@@ -76,7 +76,7 @@ echo $?
Print the current version number without details
```
gam version simple
7.39.02
7.39.03
```
In Linux/MacOS you can do:
```
@@ -86,7 +86,7 @@ echo $VER
Print the current version of Gam and address of this Wiki
```
gam help
GAM 7.39.02 - https://github.com/GAM-team/GAM
GAM 7.39.03 - https://github.com/GAM-team/GAM
GAM Team <google-apps-manager@googlegroups.com>
Python 3.14.3 64-bit final
macOS Tahoe 26.3.1 arm64