Find all Calendars and Drives shared with a group

187 views
Skip to first unread message

Patrick Haley

unread,
Dec 16, 2024, 10:07:09 PM12/16/24
to GAM for Google Workspace
Hey all, 

I could use some help with a query to do the following:

Part 1: Swap calendar access
  1. Find all calendars shared with old_group_name
  2. Add new_group_name to those calendars with the same permissions
  3. Remove old_group_name from those calendars
Part 2: Swap drive access
  1. Find all shared drives shared with old_group_name
  2. Add new_group_name to those shared with the same permissions
  3. Remove old_group_name from those shared drives
Does anyone have any tips on the best way to accomplish this?


Ross Scroggs

unread,
Dec 17, 2024, 12:18:47 AM12/17/24
to google-ap...@googlegroups.com

See: https://github.com/GAM-team/GAM/wiki/Users-Calendars-Access#display-calendar-access

See: https://github.com/GAM-team/GAM/wiki/CSV-Output-Filtering#column-row-filtering


# Get calendars shared to oldg...@domain.com                                                                                                                                                                                                                                                       

gam config auto_batch_min 1 num_threads 10 csv_output_row_filter "scope.value:text=oldg...@domain.com" redirect csv ./OldGroupCalendarAccess.csv multiprocess redirect stderr - multiprocess  all users print calendaracls minaccessrole owner


See: https://github.com/GAM-team/GAM/wiki/Users-Calendars-Access#manage-calendar-access


# Share those calendars to newg...@domain.com with the same role as oldg...@domain.com                                                                                                                                                                                                            

gam config num_threads 10 redirect stdout ./AddNewGroupToOldGroupCalendars.txt multiprocess redirect stderr stdout csv ./OldGroupCalendarAccess.csv gam user "~primaryEmail" add calendaracls "~calendarId" "~role" "group:newg...@domain.com" sendnotifications false


# Delete oldg...@domain.com access to calendars                                                                                                                                                                                                                                                    

gam config num_threads 10 redirect stdout ./DeleteOldGroupCalendarAccess.txt multiprocess redirect stderr stdout csv ./OldGroupCalendarAccess.csv gam user "~primaryEmail" delete calendaracls "~calendarId" "~id"


See: https://github.com/GAM-team/GAM/wiki/Shared-Drives#display-shared-drive-access-for-selected-shared-drives

See: https://github.com/GAM-team/GAM/wiki/Permission-Matches


# Get oldg...@domain.com Shared Drive memberships                                                                                                                                                                                                                                                  

gam redirect csv ./OldGroupSharedDriveMemberships.csv print teamdriveacls pm type group emailaddress oldg...@domain.com em oneitemperrow


See: https://github.com/GAM-team/GAM/wiki/Shared-Drives#manage-shared-drive-access


# Add newg...@domain.com as a member with the same role as oldg...@domain.com                                                                                                                                                                                                                     

gam config num_threads 10 redirect stdout ./AddNewGroupToOldGroupSharedDrives.txt multiprocess redirect stderr stdout csv ./OldGroupSharedDriveMemberships.csv gam add drivefileacl "~id" group newg...@domain.com role "~permission.role"


# Delete oldg...@domain.com Shared Drive memberships                                                                                                                                                                                                                                               

gam config num_threads 10 redirect stdout ./DeleteOldGroupSharedDriveMemberships.txt multiprocess redirect stderr stdout csv ./OldGroupSharedDriveMemberships.csv gam delete drivefileacl "~id" "id:~~permission.id~~"


Ross


----
Ross Scroggs



--
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/9f302419-ad3d-46d6-99ab-d5e6bce7e480n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages