From f40f63181070d6f7ed50f69731bde0c721a6403d Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Sun, 25 Aug 2024 08:01:48 -0700 Subject: [PATCH] Updated `gam print messages|threads` --- docs/GamUpdates.md | 14 ++++- docs/How-to-Upgrade-from-Standard-GAM.md | 4 +- docs/Users-Drive-Files-Display.md | 74 ++++++++++++++++-------- docs/Version-and-Help.md | 12 ++-- src/GamUpdate.txt | 14 ++++- src/gam/__init__.py | 10 +++- 6 files changed, 90 insertions(+), 38 deletions(-) diff --git a/docs/GamUpdates.md b/docs/GamUpdates.md index 96d12ac8..6721a312 100644 --- a/docs/GamUpdates.md +++ b/docs/GamUpdates.md @@ -10,15 +10,23 @@ Add the `-s` option to the end of the above commands to suppress creating the `g See [Downloads-Installs](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads-Installs) for Windows or other options, including manual installation +### 6.80.14 + +Updated `gam print messages|threads` to display all default headers +even if no messages are to be displayed. This eliminates error messages of the following form +that occurred because only the headers `User,threadId,id` were displayed. +``` +WARNING: csv_output_row_filter column "^Date$" does not match any output columns +``` + ### 6.80.13 Added `my_publishable_items` to `` that can be used in `gam print filerevisions` to select only those items that can be published to the web: documents, forms, presentations(slides), spreadsheets. With row filtering, this allows identification of files that have been published outside your domain. -``` -gam config csv_output_row_filter "revisions.0.publishedOutsideDomain:boolean:true" user user@domain.com print filerevisions my_publishable_items select last 1 -``` + +* See: https://github.com/taers232c/GAMADV-XTD3/wiki/Users-Drive-Files-Display#display-files-published-to-the-web ### 6.80.12 diff --git a/docs/How-to-Upgrade-from-Standard-GAM.md b/docs/How-to-Upgrade-from-Standard-GAM.md index 4c5ca21a..483e65c6 100644 --- a/docs/How-to-Upgrade-from-Standard-GAM.md +++ b/docs/How-to-Upgrade-from-Standard-GAM.md @@ -251,7 +251,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 -GAMADV-XTD3 6.80.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.80.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.5 64-bit final MacOS Sonoma 14.5 x86_64 @@ -923,7 +923,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 -GAMADV-XTD3 6.80.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.80.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.5 64-bit final Windows-10-10.0.17134 AMD64 diff --git a/docs/Users-Drive-Files-Display.md b/docs/Users-Drive-Files-Display.md index 03556164..fd5d0283 100644 --- a/docs/Users-Drive-Files-Display.md +++ b/docs/Users-Drive-Files-Display.md @@ -31,6 +31,7 @@ - [File selection with or without a particular drive label](#file-selection-with-or-without-a-particular-drive-label) - [Handle empty file lists](#handle-empty-file-lists) - [Display disk usage](#display-disk-usage) +- [Display files published to the web](#display-files-published-to-the-web) ## API documentation * https://developers.google.com/drive/api/v3/reference/files @@ -1645,40 +1646,67 @@ Use the `show` option to control the display of data: ### Examples ``` -$ gam redirect csv ./MyDriveUsage.csv user testsimple@domain.com print diskusage mydrive -User: testsimple@domain.com, Print 1 Drive Disk Usage +$ gam redirect csv ./MyDriveUsage.csv user user@domain.com print diskusage mydrive +User: user@domain.com, Print 1 Drive Disk Usage $ more MyDriveUsage.csv User,Owner,id,name,ownedByMe,trashed,explicitlyTrashed,directFileCount,directFileSize,directFolderCount,totalFileCount,totalFileSize,totalFolderCount,depth,path -testsimple@domain.com,testsimple@domain.com,012YenC8f12ALUk9PVA,My Drive,,False,False,100,138212,24,167,189598,79,-1,My Drive -testsimple@domain.com,testsimple@domain.com,456YenC8f12ALfndaQ1NHc0RtUG92Y1BIUUl4bjVBRmNkWG5oakNqVVFDcXJWOHNmdFlwZmc,Classroom,True,False,False,0,0,15,9,6840,17,0,My Drive/Classroom -testsimple@domain.com,testsimple@domain.com,0B3YenC8f12ALfmRuX3I4WFlqaTRnMGhXNkVvWV9UUG1zRDQwY1BwVkJhUGx5WHVIcjJKZUU,TestUpdate,True,False,False,2,3420,0,2,3420,0,1,My Drive/Classroom/TestUpdate -testsimple@domain.com,testsimple@domain.com,1MT5xJ897oYa0Q2OuzBDfLHvig6k_b0EKaovVA2imGYcnrmqZu5hjlJkEPMH-rHKj4qDyy9_j,TS Course,True,False,False,0,0,0,0,0,0,1,My Drive/Classroom/TS Course -testsimple@domain.com,testsimple@domain.com,1gsbqsbhhwBx9hCF0sqtE213tpUn6Ebj2klLFhHb4xkzBKIdEFkvvwCVtZpYWPgOA796fIPEN,TS Course 2,True,False,False,0,0,0,0,0,0,1,My Drive/Classroom/TS Course 2 +user@domain.com,user@domain.com,012YenC8f12ALUk9PVA,My Drive,,False,False,100,138212,24,167,189598,79,-1,My Drive +user@domain.com,user@domain.com,456YenC8f12ALfndaQ1NHc0RtUG92Y1BIUUl4bjVBRmNkWG5oakNqVVFDcXJWOHNmdFlwZmc,Classroom,True,False,False,0,0,15,9,6840,17,0,My Drive/Classroom +user@domain.com,user@domain.com,0B3YenC8f12ALfmRuX3I4WFlqaTRnMGhXNkVvWV9UUG1zRDQwY1BwVkJhUGx5WHVIcjJKZUU,TestUpdate,True,False,False,2,3420,0,2,3420,0,1,My Drive/Classroom/TestUpdate +user@domain.com,user@domain.com,1MT5xJ897oYa0Q2OuzBDfLHvig6k_b0EKaovVA2imGYcnrmqZu5hjlJkEPMH-rHKj4qDyy9_j,TS Course,True,False,False,0,0,0,0,0,0,1,My Drive/Classroom/TS Course +user@domain.com,user@domain.com,1gsbqsbhhwBx9hCF0sqtE213tpUn6Ebj2klLFhHb4xkzBKIdEFkvvwCVtZpYWPgOA796fIPEN,TS Course 2,True,False,False,0,0,0,0,0,0,1,My Drive/Classroom/TS Course 2 ... -testsimple@domain.com,testsimple@domain.com,1bHS_Tp77W3KSGRNSs_jP1RhAJhIGRCaI,XferFolder,True,False,False,1,1024,0,1,1024,0,0,My Drive/XferFolder -testsimple@domain.com,testsimple@domain.com,Trash,Trash,,True,True,0,0,1,3,3072,9,-1,Trash +user@domain.com,user@domain.com,1bHS_Tp77W3KSGRNSs_jP1RhAJhIGRCaI,XferFolder,True,False,False,1,1024,0,1,1024,0,0,My Drive/XferFolder +user@domain.com,user@domain.com,Trash,Trash,,True,True,0,0,1,3,3072,9,-1,Trash -$ gam config csv_output_row_filter "depth:count<1" redirect csv ./MyDriveUsage.csv user testsimple@domain.com print diskusage mydrive -User: testsimple@domain.com, Print 1 Drive Disk Usage +$ gam config csv_output_row_filter "depth:count<1" redirect csv ./MyDriveUsage.csv user user@domain.com print diskusage mydrive +User: user@domain.com, Print 1 Drive Disk Usage $ more MyDriveUsage.csv User,Owner,id,name,ownedByMe,trashed,explicitlyTrashed,directFileCount,directFileSize,directFolderCount,totalFileCount,totalFileSize,totalFolderCount,depth,path -testsimple@domain.com,testsimple@domain.com,012YenC8f12ALUk9PVA,My Drive,,False,False,100,138212,24,167,189598,79,-1,My Drive -testsimple@domain.com,testsimple@domain.com,456YenC8f12ALfndaQ1NHc0RtUG92Y1BIUUl4bjVBRmNkWG5oakNqVVFDcXJWOHNmdFlwZmc,Classroom,True,False,False,0,0,15,9,6840,17,0,My Drive/Classroom +user@domain.com,user@domain.com,012YenC8f12ALUk9PVA,My Drive,,False,False,100,138212,24,167,189598,79,-1,My Drive +user@domain.com,user@domain.com,456YenC8f12ALfndaQ1NHc0RtUG92Y1BIUUl4bjVBRmNkWG5oakNqVVFDcXJWOHNmdFlwZmc,Classroom,True,False,False,0,0,15,9,6840,17,0,My Drive/Classroom ... -testsimple@domain.com,testsimple@domain.com,1bHS_Tp77W3KSGRNSs_jP1RhAJhIGRCaI,XferFolder,True,False,False,1,1024,0,1,1024,0,0,My Drive/XferFolder -testsimple@domain.com,testsimple@domain.com,Trash,Trash,,True,True,0,0,1,3,3072,9,-1,Trash +user@domain.com,user@domain.com,1bHS_Tp77W3KSGRNSs_jP1RhAJhIGRCaI,XferFolder,True,False,False,1,1024,0,1,1024,0,0,My Drive/XferFolder +user@domain.com,user@domain.com,Trash,Trash,,True,True,0,0,1,3,3072,9,-1,Trash -$ gam redirect csv ./MyDriveUsage.csv user testsimple@domain.com print diskusage mydrive show summaryandtrash -User: testsimple@domain.com, Print 1 Drive Disk Usage +$ gam redirect csv ./MyDriveUsage.csv user user@domain.com print diskusage mydrive show summaryandtrash +User: user@domain.com, Print 1 Drive Disk Usage $ more MyDriveUsage.csv User,Owner,id,name,ownedByMe,trashed,explicitlyTrashed,directFileCount,directFileSize,directFolderCount,totalFileCount,totalFileSize,totalFolderCount,depth,path -testsimple@domain.com,testsimple@domain.com,012YenC8f12ALUk9PVA,My Drive,,False,False,100,138212,24,167,189598,79,-1,My Drive -testsimple@domain.com,testsimple@domain.com,Trash,Trash,,True,True,0,0,1,3,3072,9,-1,Trash +user@domain.com,user@domain.com,012YenC8f12ALUk9PVA,My Drive,,False,False,100,138212,24,167,189598,79,-1,My Drive +user@domain.com,user@domain.com,Trash,Trash,,True,True,0,0,1,3,3072,9,-1,Trash -$ gam redirect csv ./MyDriveUsage.csv user testsimple@domain.com print diskusage shareddriveid 0AL5LiIe4dqxZUk9PVA show summaryandtrash -User: testsimple@domain.com, Print 1 Drive Disk Usage +$ gam redirect csv ./MyDriveUsage.csv user user@domain.com print diskusage shareddriveid 0AL5LiIe4dqxZUk9PVA show summaryandtrash +User: user@domain.com, Print 1 Drive Disk Usage $ more MyDriveUsage.csv User,id,name,trashed,explicitlyTrashed,directFileCount,directFileSize,directFolderCount,totalFileCount,totalFileSize,totalFolderCount,depth,path -testsimple@domain.com,0125LiIe4dqxZUk9PVA,TS Shared Drive 1,False,False,16,6144,7,42,73799,25,-1,SharedDrives/TS Shared Drive 1 -testsimple@domain.com,Trash,Trash,True,True,1,1024,0,1,1024,0,-1,Trash +user@domain.com,0125LiIe4dqxZUk9PVA,TS Shared Drive 1,False,False,16,6144,7,42,73799,25,-1,SharedDrives/TS Shared Drive 1 +user@domain.com,Trash,Trash,True,True,1,1024,0,1,1024,0,-1,Trash +``` + +## Display files published to the web +Ths requires version 6.80.13 or later. + +You can display files published to the web. +``` +# Get the published files +gam config csv_output_header_filter "Owner,id,revisions.0.published,revisions.0.publishedOutsideDomain" csv_output_row_filter "revisions.0.published:boolean:true" auto_batch_min 1 num_threads 20 redirect csv ./PublishedDocs.csv multiprocess redirect stderr - multiprocess print filerevisions my_publishable_items select last 1 +# Get the files name, MIMEtype and path +gam redirect csv ./PublishedDocsWithName.csv multiprocess redirect stderr - multiprocess csv ./PublishedDocs.csv gam user "~Owner" print filelist select "~id" fields id,name,mimetype fullpath addcsvdata published "~revisions.0.published" addcsvdata publishedOutsideDomain "~revisions.0.publishedOutsideDomain" +``` + +You can display files published to the web internally for your domain only. +``` +# Get the internally only published files +gam config csv_output_header_filter "Owner,id,revisions.0.published,revisions.0.publishedOutsideDomain" csv_output_row_filter "revisions.0.published:boolean:true,revisions.0.publishedOutsideDomain:boolean:false" auto_batch_min 1 num_threads 20 redirect csv ./PublishedDocs.csv multiprocess redirect stderr - multiprocess print filerevisions my_publishable_items select last 1 +# Get the files name, MIMEtype and path +gam redirect csv ./PublishedDocsWithName.csv multiprocess redirect stderr - multiprocess csv ./PublishedDocs.csv gam user "~Owner" print filelist select "~id" fields id,name,mimetype fullpath addcsvdata published "~revisions.0.published" addcsvdata publishedOutsideDomain "~revisions.0.publishedOutsideDomain" +``` + +You can display files published to the web externally outside of your domain. +``` +# Get the externally published files +gam config csv_output_header_filter "Owner,id,revisions.0.published,revisions.0.publishedOutsideDomain" csv_output_row_filter "revisions.0.published:boolean:true,revisions.0.publishedOutsideDomain:boolean:true" auto_batch_min 1 num_threads 20 redirect csv ./PublishedDocs.csv multiprocess redirect stderr - multiprocess print filerevisions my_publishable_items select last 1 +# Get the files name, MIMEtype and path +gam redirect csv ./PublishedDocsWithName.csv multiprocess redirect stderr - multiprocess csv ./PublishedDocs.csv gam user "~Owner" print filelist select "~id" fields id,name,mimetype fullpath addcsvdata published "~revisions.0.published" addcsvdata publishedOutsideDomain "~revisions.0.publishedOutsideDomain" ``` diff --git a/docs/Version-and-Help.md b/docs/Version-and-Help.md index 1d875e7d..c54118c4 100644 --- a/docs/Version-and-Help.md +++ b/docs/Version-and-Help.md @@ -3,7 +3,7 @@ Print the current version of Gam with details ``` gam version -GAMADV-XTD3 6.80.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.80.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.5 64-bit final MacOS Sonoma 14.5 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.80.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.80.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.5 64-bit final MacOS Sonoma 14.5 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.80.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.80.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.5 64-bit final MacOS Sonoma 14.5 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.80.13 + Latest: 6.80.14 echo $? 1 ``` @@ -72,7 +72,7 @@ echo $? Print the current version number without details ``` gam version simple -6.80.13 +6.80.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.80.13 - https://github.com/taers232c/GAMADV-XTD3 +GAM 6.80.14 - https://github.com/taers232c/GAMADV-XTD3 Ross Scroggs Python 3.12.5 64-bit final MacOS Sonoma 14.5 x86_64 diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index d7143a86..51c5daf2 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -2,15 +2,23 @@ Merged GAM-Team version +6.80.14 + +Updated `gam print messages|threads` to display all default headers +even if no messages are to be displayed. This eliminates error messages of the following form +that occurred because only the headers `User,threadId,id` were displayed. +``` +WARNING: csv_output_row_filter column "^Date$" does not match any output columns +``` + 6.80.13 Added `my_publishable_items` to `` that can be used in `gam print filerevisions` to select only those items that can be published to the web: documents, forms, presentations(slides), spreadsheets. With row filtering, this allows identification of files that have been published outside your domain. -``` -gam config csv_output_row_filter "revisions.0.publishedOutsideDomain:boolean:true" user user@domain.com print filerevisions my_publishable_items select last 1 -``` + +* See: https://github.com/taers232c/GAMADV-XTD3/wiki/Users-Drive-Files-Display#display-files-published-to-the-web 6.80.12 diff --git a/src/gam/__init__.py b/src/gam/__init__.py index 03a69b92..ab754185 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -69652,11 +69652,19 @@ def printShowMessagesThreads(users, entityType): csvPF.SetTitles(sortTitles) else: sortTitles = ['User', 'threadId', 'id'] - csvPF.SetTitles(sortTitles) sortTitles.extend(defaultHeaders) + if show_size: + sortTitles.append('SizeEstimate') + if show_labels: + sortTitles.extend(['LabelsCount', 'Labels']) + if show_snippet: + sortTitles.append('Snippet') + if show_body: + sortTitles.append('Body') if addCSVData: sortTitles.extend(sorted(addCSVData.keys())) _callbacks = {'batch': _callbackPrint, 'process': _printMessage if entityType == Ent.MESSAGE else _printThread} + csvPF.SetTitles(sortTitles) csvPF.SetSortTitles(sortTitles) else: if countsOnly: