Reverse sharing permission changes done using GAM

26 views
Skip to first unread message

Francis Pegus

unread,
Jan 26, 2026, 10:13:41 AM (7 days ago) Jan 26
to GAM for Google Workspace
I will be using the following commands to remove external sharing for thousands of files. Wondering is there a way to use the acls_external1-20-26.csv that the first command creates to reverse the permission removals in bulk using GAM commands?

gam config num_threads 20 redirect csv ./acls_external1-20-26.csv multiprocess csv doc-ids.csv gam user "~Owner" print filelist select "~fileid" norecursion fields id,name,mimetype,basicpermissions pm notdomain mydomain.org em pm type anyone em pmm or pmfilter oneitemperrow



gam config num_threads 20 redirect stdout ./deleteaclsexternal.txt multiprocess redirect stderr stdout csv ./acls_external.csv gam user "~Owner" delete drivefileacl "~id" "id:~~permission.id~~" enforceexpansiveaccess false


 

Ross Scroggs

unread,
Jan 26, 2026, 11:26:37 AM (7 days ago) Jan 26
to google-ap...@googlegroups.com
Restore anyone shares
gam config num_threads 20 csv_inout_row_filter "permission.type:text=anyone" redirect stdout ./restore_anyone_aclsexternal.txt multiprocess redirect stderr stdout csv ./acls_external1-20-26.csv gam user "~Owner" add drivefileacl "~id" "~permission.type" role "~permission.role" allowfilediscovery "~permission.allowFileDiscovery"

Restore domain shares
gam config num_threads 20 csv_inout_row_filter "permission.type:text=domain" redirect stdout ./restore_domain_aclsexternal.txt multiprocess redirect stderr stdout csv ./acls_external1-20-26.csv gam user "~Owner" add drivefileacl "~id" "~permission.type" "~permission.domain" role "~permission.role" allowfilediscovery "~permission.allowFileDiscovery"

Restore group shares
gam config num_threads 20 csv_inout_row_filter "permission.type:text=group" redirect stdout ./restore_group_aclsexternal.txt multiprocess redirect stderr stdout csv ./acls_external1-20-26.csv gam user "~Owner" add drivefileacl "~id" "~permission.type" "~permission.emailAddress" role "~permission.role"

Restore user shares
gam config num_threads 20 csv_inout_row_filter "permission.type:text=user" redirect stdout ./restore_user_aclsexternal.txt multiprocess redirect stderr stdout csv ./acls_external1-20-26.csv gam user "~Owner" add drivefileacl "~id" "~permission.type" "~permission.emailAddress" role "~permission.role"

Ross


--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-manager/e6a4d11b-001d-41e0-8175-b9e6333412f9n%40googlegroups.com.


--

Francis Pegus

unread,
Jan 26, 2026, 1:49:29 PM (7 days ago) Jan 26
to GAM for Google Workspace
Thanks Ross will test those out.

Francis Pegus

unread,
Jan 26, 2026, 2:57:24 PM (7 days ago) Jan 26
to GAM for Google Workspace
Ross I tried a test using the following commands but GAM runs no errors but it did not add the anyone back to the test file and the restore_anyone_aclsexternal.txt is empty. I double checked my test file acls_audit_with_domain.csv and confirmed that one line does have permission.type anyone.  Any suggestions what might be wrong? 

gam config num_threads 20 csv_input_row_filter "permission.type:text=anyone" redirect stdout ./restore_anyone_aclsexternal.txt multiprocess redirect stderr stdout csv ./acls_audit_with_domain.csv gam user "~Owner" add drivefileacl "~id" "~permission.type" role "~permission.role" allowfilediscovery "~permission.allowFileDiscovery"
Reply all
Reply to author
Forward
0 new messages