Use GAM to print orphaned Calendar Events from users?

655 views
Skip to first unread message

Leonardo Barbosa

unread,
Apr 22, 2024, 11:53:27 AM4/22/24
to GAM for Google Workspace
Hi everyone,

I have the following situation:

The "user01" invited "user02" for several meetings (both with, and without Resources like Meeting Rooms, recurrent meetings, etc.)

Now, "user01" left the company, and the Calendar data of this user wasn't transferred to other users across our organization, or to a backup, etc.

Do you know how can I find all of the "orphan calendar events" that "user01" sent to "user02", and (if possible), all of the "orphan calendar events" that "user01" sent to any other users across my organization?


I know that I can use something like this:
  1. Use "gam calendar use...@mydomain.com print events todrive" to print all of the calendar events of the "user02";
  2. Find all events for use...@mydomain.com where the "organizer.email" is the former "use...@mydomain.com" email address.
  3. From those events, we get the ID of the events (the one that GAM returns in column B of the "print command")
  4. We run the following Delete GAM command: "gam calendar use...@mydomain.com delete event id [insert the event ID here] doit"
    1. (I'm not sure if the "Delete Command above also deletes Recurrences)

I'm not sure if with GAM we have a command that will print only the specific orphaned calendar events of former users who are not in our Google Workspace anymore.

Any help is appreciated. And if I find something on my end useful to fix this, I'll let you know here too, ok!

Best,
Leonardo



Ross Scroggs

unread,
Apr 22, 2024, 1:08:07 PM4/22/24
to google-ap...@googlegroups.com
Leonardo,

I think that you're on the right track, send me a Meet/Zoom ibvitation to discuss.

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 on the web visit https://groups.google.com/d/msgid/google-apps-manager/38cb6126-351e-4187-bfbc-9cf43bf59e23n%40googlegroups.com.

Leonardo Barbosa

unread,
Apr 23, 2024, 4:27:22 AM4/23/24
to GAM for Google Workspace
Hey Ross,

Sent an invite to you today at 18:00 (Central European Summer Time GMT +2), ok? If it doesn't work for you, let me know what is your preferred schedule so I can arrange myself accordingly :D

Best,
Leonardo

Leonardo Barbosa

unread,
Apr 24, 2024, 11:04:54 AM4/24/24
to GAM for Google Workspace
Hey Ross,

Thank you for your help yesterday! It worked!

For reference, in case someone has a similar issue in the future:

Print the "orphan events" for a user:

gam calendar [user02 email address] print events matchfield creatoremail [user01 email address] todrive

Then delete the orphan events for the user 02, in a sophisticated way:

gam redirect stdout ./DeletionLogs.txt multiprocess redirect stderr stdout csv gsheet youruser_emailaddress [ID of the spreadsheet from the Print command] id:["gid" of the spreadsheet from the Print command] gam calendar ~calendarId delete events eventid ~id doit sendnotifications false

Harold Wong

unread,
May 8, 2024, 12:37:21 PM5/8/24
to GAM for Google Workspace
This is very useful, is there a way to do an audit of all events to determine if there are orphaned events? If we dont know user1, 2, 3 were deleted years ago or offboarded 'correctly'.
It would be a good yearly thing to audit for

Leonardo Barbosa

unread,
May 21, 2024, 3:10:23 PM5/21/24
to GAM for Google Workspace
Good idea, Harold!

Not sure how we could do this though. Maybe trying to play with GAM/the APIs to find out "for each user in your GWS, how many calendar events where the creator/organizer is not an existing user in GWS" ? 
Reply all
Reply to author
Forward
0 new messages