Added option addcsvdata <FieldName> <String> to gam report [usage] customers|users

This commit is contained in:
Ross Scroggs
2025-10-31 07:31:33 -07:00
parent d8c5d237b9
commit 2ac6e361f0
5 changed files with 60 additions and 18 deletions

View File

@@ -10,6 +10,17 @@ 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.28.00
Added option `addcsvdata <FieldName> <String>` to `gam report [usage] customers|users`
that adds additional columns of data to the CSV file output. This will be most useful
when reading a CSV of user information and you want to include some of the user information,
e.g., orgUnitPath, in the output.
```
gam redirect csv ./Users.csv print users fields ou
gam redirect csv ./UserStorageInfo.csv multiprocess csv Users.csv gam report users user "~primaryEmail" parameters accounts:drive_used_quota_in_mb,accounts:gmail_used_quota_in_mb,accounts:gplus_photos_used_quota_in_mb,accounts:total_quota_in_mb,accounts:used_quota_in_mb,accounts:used_quota_in_percentage addcsvdata orgUnitPath "~orgUnitPath"
```
### 7.27.05
Added option `addcsvdata <FieldName> <String>` to `gam print courses`

View File

@@ -252,7 +252,7 @@ writes the credentials into the file oauth2.txt.
admin@server:/Users/admin$ rm -f /Users/admin/GAMConfig/oauth2.txt
admin@server:/Users/admin$ gam version
WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
GAM 7.27.05 - https://github.com/GAM-team/GAM - pyinstaller
GAM 7.28.00 - https://github.com/GAM-team/GAM - pyinstaller
GAM Team <google-apps-manager@googlegroups.com>
Python 3.14.0 64-bit final
macOS Tahoe 26.0.1 x86_64
@@ -990,7 +990,7 @@ writes the credentials into the file oauth2.txt.
C:\>del C:\GAMConfig\oauth2.txt
C:\>gam version
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
GAM 7.27.05 - https://github.com/GAM-team/GAM - pythonsource
GAM 7.28.00 - https://github.com/GAM-team/GAM - pythonsource
GAM Team <google-apps-manager@googlegroups.com>
Python 3.14.0 64-bit final
Windows-10-10.0.17134 AMD64

View File

@@ -213,6 +213,7 @@ gam report usage customer [todrive <ToDriveAttribute>*]
[skipdates <Date>[:<Date>](,<Date>[:<Date>])*] [skipdaysofweek <DayOfWeek>(,<DayOfWeek>)*]
[fields|parameters <String>]
[convertmbtogb]
(addcsvdata <FieldName> <String>)*
```
Limit the time period.
* `start <Date>` - Default value is 30 days prior to `end <Date>`
@@ -224,6 +225,9 @@ Limit the time period.
Option `convertmbtogb` causes GAM to convert parameters expressed in megabytes
(name ends with _in_mb) to gigabytes (name converted to _in_gb) with two decimal places.
Add additional columns of data from the command line to the output.
* `addcsvdata <FieldName> <String>`
### Example
Jay provided this example.
```
@@ -267,6 +271,7 @@ gam report customers|customer|domain [todrive <ToDriveAttribute>*]
[(fields|parameters <String>)|(services <CustomerServiceNameList>)]
[noauthorizedapps]
[convertmbtogb]
(addcsvdata <FieldName> <String>)*
```
Specify the report date; the default is today's date.
* `date <Date>` - A single date; there is one API call
@@ -279,6 +284,9 @@ Specify the report date; the default is today's date.
Option `convertmbtogb` causes GAM to convert parameters expressed in megabytes
(name ends with _in_mb) to gigabytes (name converted to _in_gb) with two decimal places.
Add additional columns of data from the command line to the output.
* `addcsvdata <FieldName> <String>`
If no report is available for the specified date, can an earlier date be used?
* `limitdatechanges -1' - Back up to earlier dates to find report data; this is the default.
* `limitdatechanges 0 | nodatechange' - Do not report on an earlier date if no report data is available for the specified date.
@@ -332,6 +340,7 @@ gam report usage user [todrive]
[skipdates <Date>[:<Date>](,<Date>[:<Date>])*] [skipdaysofweek <DayOfWeek>(,<DayOfWeek>)*]
[fields|parameters <String>]
[convertmbtogb]
(addcsvdata <FieldName> <String>)*
```
Select the users for whom information is desired.
* `user all` - All users, the default; there is one API call
@@ -350,6 +359,9 @@ Limit the time period.
Option `convertmbtogb` causes GAM to convert parameters expressed in megabytes
(name ends with _in_mb) to gigabytes (name converted to _in_gb) with two decimal places.
Add additional columns of data from the command line to the output.
* `addcsvdata <FieldName> <String>`
## User reports
User reports are generally available up to four days before the current date.
```
@@ -374,6 +386,7 @@ gam report users|user [todrive <ToDriveAttribute>*]
[aggregatebydate|aggregatebyuser [Boolean]]
[maxresults <Number>]
[convertmbtogb]
(addcsvdata <FieldName> <String>)*
```
Select the users for whom information is desired.
* `user all` - All users, the default; there is one API call
@@ -396,6 +409,16 @@ Specify the report date; the default is today's date.
Option `convertmbtogb` causes GAM to convert parameters expressed in megabytes
(name ends with _in_mb) to gigabytes (name converted to _in_gb) with two decimal places.
Add additional columns of data from the command line to the output.
* `addcsvdata <FieldName> <String>`
This will be most useful when reading a CSV of user information and you want to include some of the user information,
e.g., orgUnitPath, in the output.
```
gam redirect csv ./Users.csv print users fields ou
gam redirect csv ./UserStorageInfo.csv multiprocess csv Users.csv gam report users user "~primaryEmail" parameters accounts:drive_used_quota_in_mb,accounts:gmail_used_quota_in_mb,accounts:gplus_photos_used_quota_in_mb,accounts:total_quota_in_mb,accounts:used_quota_in_mb,accounts:used_quota_in_percentage addcsvdata orgUnitPath "~orgUnitPath"
```
If no report is available for the specified date, can an earlier date be used?
* `limitdatechanges -1' - Back up to earlier dates to find report data; this is the default.
* `limitdatechanges 0 | nodatechange' - Do not report on an earlier date if no report data is available for the specified date.
@@ -452,6 +475,11 @@ Report on users total storage usage.
```
gam report users parameters accounts:drive_used_quota_in_mb,accounts:gmail_used_quota_in_mb,accounts:gplus_photos_used_quota_in_mb,accounts:total_quota_in_mb,accounts:used_quota_in_mb,accounts:used_quota_in_percentage
```
Report on users total storage usage, include OrgUnitPath
```
gam redirect csv ./Users.csv print users fields ou
gam redirect csv ./UserStorageInfo.csv multiprocess csv Users.csv gam report users user "~primaryEmail" parameters accounts:drive_used_quota_in_mb,accounts:gmail_used_quota_in_mb,accounts:gplus_photos_used_quota_in_mb,accounts:total_quota_in_mb,accounts:used_quota_in_mb,accounts:used_quota_in_percentage addcsvdata orgUnitPath "~orgUnitPath"
```
Report on email activity for individual users.
```
$ gam report users select users testuser1,testuser2,testuser3 fields gmail:num_emails_received,gmail:num_emails_sent range 2025-07-01 2025-07-07

View File

@@ -117,25 +117,28 @@ specify `basicpermissions` and additional permission fields, e.g., `permissions.
<DriveFileACLRoleList> ::= "<DriveFileACLRole>(,<DriveFileACLRole>)*"
<DriveFileACLType> ::= anyone|domain|group|user
<DriveFileACLTypeList> ::= "<DriveFileACLType>(,<DriveFileACLType>)*"
<DriveFilePermission> ::=
anyone|anyonewithlink|
user:<EmailAddress>|group:<EmailAddress>|
domain:<DomainName>|domainwithlink:<DomainName>;<DriveFileACLRole>
<DriveFilePermissionID> ::=
anyone|anyonewithlink|id:<String>
<DriveFilePermissionIDorEmail> ::=
<DriveFilePermissionID>|<EmailAddress>
<DriveFilePermissionList> ::=
"<DriveFilePermission>(,<DriveFilePermission)*"
<DriveFilePermissionIDList> ::=
"<DriveFilePermissionID>(,<DriveFilePermissionID>)*"
<DriveFilePermissionEntity> ::=
<DriveFilePermissionList> |
<DriveFilePermissionIDEntity> ::=
<DriveFilePermissionIDList> |
(json [charset <Charset>] <JSONData>)|(json file <FileName> [charset <Charset>]) |
<FileSelector> | <CSVFileSelector> | <CSVkmdSelector> | <CSVDataSelector>
See: https://github.com/GAM-team/GAM/wiki/Collections-of-Items
<DriveFilePermissionIDEntity> ::=
<DriveFilePermissionIDList> |
<DriveFilePermission> ::=
anyone;<DriveFileACLRole> |
anyonewithlink;<DriveFileACLRole> |
domain:<DomainName>;<DriveFileACLRole> |
domainwithlink:<DomainName>;<DriveFileACLRole> |
group:<EmailAddress>;<DriveFileACLRole> |
user:<EmailAddress>;<DriveFileACLRole>
<DriveFilePermissionList> ::=
"<DriveFilePermission>(,<DriveFilePermission)*"
<DriveFilePermissionEntity> ::=
<DriveFilePermissionList> |
(json [charset <Charset>] <JSONData>)|(json file <FileName> [charset <Charset>]) |
<FileSelector> | <CSVFileSelector> | <CSVkmdSelector> | <CSVDataSelector>
See: https://github.com/GAM-team/GAM/wiki/Collections-of-Items

View File

@@ -3,7 +3,7 @@
Print the current version of Gam with details
```
gam version
GAM 7.27.05 - https://github.com/GAM-team/GAM - pyinstaller
GAM 7.28.00 - https://github.com/GAM-team/GAM - pyinstaller
GAM Team <google-apps-manager@googlegroups.com>
Python 3.14.0 64-bit final
macOS Tahoe 26.0.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
GAM 7.27.05 - https://github.com/GAM-team/GAM - pyinstaller
GAM 7.28.00 - https://github.com/GAM-team/GAM - pyinstaller
GAM Team <google-apps-manager@googlegroups.com>
Python 3.14.0 64-bit final
macOS Tahoe 26.0.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
GAM 7.27.05 - https://github.com/GAM-team/GAM - pyinstaller
GAM 7.28.00 - https://github.com/GAM-team/GAM - pyinstaller
GAM Team <google-apps-manager@googlegroups.com>
Python 3.14.0 64-bit final
macOS Tahoe 26.0.1 x86_64
@@ -68,7 +68,7 @@ MacOS High Sierra 10.13.6 x86_64
Path: /Users/Admin/bin/gam7
Version Check:
Current: 5.35.08
Latest: 7.27.05
Latest: 7.28.00
echo $?
1
```
@@ -76,7 +76,7 @@ echo $?
Print the current version number without details
```
gam version simple
7.27.05
7.28.00
```
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.27.05 - https://github.com/GAM-team/GAM
GAM 7.28.00 - https://github.com/GAM-team/GAM
GAM Team <google-apps-manager@googlegroups.com>
Python 3.14.0 64-bit final
macOS Tahoe 26.0.1 x86_64