Calendar

ACLs

Show

gam calendar <Calendar Email Address> show acls

Add

To share a calendar, add another user as a writer. Change writer to editor|freebusy|freebusyreader|owner|reader|writer if different permissions are required. Use sendnotifications false to prevent the user needing to accept the email invitation.

gam calendar <Calendar Email Address> add acls writer <User Email Address> sendnotifications false

For the user to see the Calendar, you need to run this command.

gam user <User Email Address> add calendar <Calendar Email Address> selected true

Update

To change the permission level of a person that already has access to the calendar to owner. Change owner to editor|freebusy|freebusyreader|owner|reader|writer  if different permissions are required. 

gam calendar <Calendar Email Address> update acls owner <User Email Address>

Delete

gam calendar <Calendar Email Address> delete acls <Role> <User Email Address>

Create

In Other Users Calendars

Change the start and end date/time as well as the relevant email addresses and title.

gam calendar <Event Owner Email> create event start 2020-04-16T17:00:00-07:00 end 2020-04-16T18:00:00-07:00 selectattendees accepted users <Attendee 1 Email>,<Attendee 2 Email>,<Attendee 3 Email>, summary "<Event Title>"

Recurring Event

Add an annually recurring event to a users calendar.

gam calendar <User Email Address> addevent start allday <Start Date> end allday <End Date> summary "<Event Name>" recurrence RRULE:FREQ=YEARLY transparency transparent

From a Google Sheet

Create Calendar Events from data in a Google Sheet.

gam csv gsheet <Sheet Owner Email> <Google Sheet ID> '<Tab Name>' gam calendar ~EventOwnerEmail create event start ~Start end ~End selectattendees accepted users ~Attendees summary "~EventTitle"

Separate Google Sheet

Adding the options in red will create a Google Sheet of the created Events details.

gam redirect csv - multiprocess append todrive csv gsheet <Sheet Owner Email> <Google Sheet ID> '<Tab Name>' gam calendar ~EventOwnerEmail create event start ~Start end ~End selectattendees accepted users ~Attendees summary "~EventTitle" csv

Same Google Sheet

However expanding this you can update a different tab (<Tab ID>) on the same Google Sheet.

gam redirect csv - multiprocess append todrive tdfileid <Google Sheet ID> tdsheet id:<Tab ID> tdupdatesheet tdtitle "<Google Sheet Name>" tdtimeformat %Y-%m-%d tdclearfilter true csv gsheet <Sheet Owner Email> <Google Sheet ID> '<Tab Name>' gam calendar ~EventOwnerEmail create event start ~Start end ~End selectattendees accepted users ~Attendees summary "~EventTitle" csv

CalSettings

Show users calendar settings

gam user <user email address> show calsettings

gam ou_and_children_ns <top level OU> print calsettings todrive

Delete

Single Calendar

gam user <User Email Address> delete calendar <CalendarItem>

CSV

User the p

gam csv gsheet <User Email Address> <File ID> <Sheet Name> gam user <User Email Address> delete calendar ~calendarId

Single Calendar Event

gam calendar <Calendar Email Address> delete event id <Calendar ID> doit

Print Calendaracls

These commands will list all the ACLs (permissions/roles) for all the uses for the calendars

User

gam user <user email address> print calendaracls todrive tdtitle "<File Name>"

OU

gam ou_and_children_ns </Path/to/OU> print calendaracls todrive tdtitle "<File Name>"

All Users

gam all users print calendaracls todrive tdtitle "<File Name>"

To see if a calendar is Public check the scope.value column for __public_principal__@public.calendar.google.com

Print Calendars

User

To show a users Calendars, use this command. Note the Reminders and Tasks calendars are not listed. Use the showhidden option to see all the calendars.

gam user <User Email Address> print calendars showhidden todrive

NoPrimary & NoSystem

The results of this can then be fed into a command to remove all calendars from a user, except their own calendar and the system calendar.

gam user <User Email Address> print calendars noprimary nosystem todrive

Print Events

Non-private Calendar Events

This command will show all the fields

gam calendar <User Email Address> print events todrive

Before Now

Print events before today (now)

gam calendar <User Email Address> print event before now matchfield status confirmed todrive

Date range

Print events after a date (yyyy-mm-dd) before today (now)

gam calendar <User Email Address> print event before now after yyyy-mm-dd matchfield status confirmed todrive

Using the fields summary,starttime,recurrence option will reduce the output to the event ID and name.

gam calendar <User Email Address> print events after yyyy-mm-dd before yyyy-mm-dd fields summary,starttime,recurrence todrive

Show

Query

Show the details of a specific event in a calendar. Change show to print todrive if there are multiple results as this should make it easy to read.

gam calendar <Calendar ID> show events query "<Event Title>"

Transfer

Transfer all events to Another User (not tested)

gam create datatransfer|transfer <OldOwnerID> calendar <NewOwnerID> [release_resources]

Move a Specific Event to Another User (not tested)

gam calendar <CalendarEntity> move event <EventEntity> to <CalendarItem> [notifyattendees]

Update Event

Add Meet Link

Use the hangoutsmeet option to add a Meet link to an existing Calender Event

gam user <User Email Address> update event id <Event ID> hangoutsmeet

Visibility | Private

Change the visibility of events to Provate. To change all events before today (now) use this command. Or change the date range (before yyyy-mm-dd after yyyy-mm-dd) accordingly.

gam calendar <User Email Address> update event before now matchfield status confirmed visibility private

Start & End

Single Event

gam user <User Email Address> update events <User Email Address> id yyyy-mm-ddThh:mm:ss+<GMT Offset> start 'yyyy-mm-ddThh:mm:ss+<GMT Offset>' end 'yyyy-mm-ddThh:mm:ss+<GMT Offset>'

Multiple events from a Google Sheet, after generating the Google Sheet using a print events todrive command

gam csv gsheet <gSheet Owner Email> <Sheet ID> '<Sheet (Tab) Name>' gam user <User Email Address> update events <User Email Address> id ~id start '~start.dateTime' end '~end.dateTime'

Wipe

User

gam calendar <User Email Address> wipe