Skip to content

Using Google Apps Script to automatically subscribe end-users to Group Calendars via delegated admin

Notifications You must be signed in to change notification settings

Callumpy/Auto-Subscribe-to-Google-Calendars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Auto Subscribe to Google Calendars

Automatically subscribe end-users from a Google Group to a Group/Shared Calendar, using Google AppsScript and a service account for delegated admin access.

  • The calendar will appear in the user's Calendar UI automatically, no need to ask end-users to manually add calendars.
  • The script takes a list of members from a specified Google Group, and adds all those members to a specified Calendar ID.
  • This doesn't add users to the calendar's ACL, the calenader must have been made available to the user in advance (mostly through being visable to your entire organisation).
  • It can only subscribe users that belong to your domain, delegated admin access to the end-user is required.

Dependencies

  • AdminDirectory API
  • OAuth2 Library
  • ObjDB Library
  • Must have a Google Sheet linked with tabs referring to each Calendar ID
  • A Google Workspace Super Administrator is required to set-up the domain-wide delegation

Required Scopes:

https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/admin.directory.group.readonly

Installation/Usage

  1. Copy the script files from the repo into a new script. (script.google.com)
  2. Create a GCP Project and enable the Calendar API and Admin SDK from the Marketplace. - Ensure that you have enabled the OAuth consent screen.
  3. Create a GCP Service Account and create a private key to be used in the script.
  4. After creating the service account, ensure that you have enabled Google Workspace domain-wide delegataion in it's details section.
  5. Add the Service Accounts' client ID and required scopes from above into Google Workspace for domain-wide delegation, on this page.
  6. In your new AppsScript's settings, click Change Project at the bottom and enter the GCP Project number.
  7. Add the required 2 libraries and AdminDirectory service to your script editor.
  8. In config.gs, first use the setKeys() function to store your service account's private key and email address in the script properties. One you've ran the function once, you can remove the keys so they're no longer visible in plain text.
  9. Also in config.gs, Setup your Groups and Calendar IDs that will be managed by the script. See the example in the repo.
  10. Create a trigger to run the script on your own schedule.

About

Using Google Apps Script to automatically subscribe end-users to Group Calendars via delegated admin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published