google-apicalendargoogle-calendar-apigoogle-admin-sdk

Get All Calendars in Google Org via Google API


Goal: I'm trying to get all the calendars in my Gsuite org.

Problem: I know I can get a list of calendars using CalendarList.list but that's only if the user or service account has all the calendars in its list and even then it's not always accurate because the calendars don't always get added to the service account's calendar list and a user could potentially remove the calendar from their list.

Question: Is there a way to just grab every calendar in my Google org? Let's say my domain is @someorg.com. I want every user's calendar as well as calendars created through the api. I was thinking this might be possible with the GSuite Admin SDK, but I haven't been able to find anything that allows me to do this. It only handles Resources.calendars which is different than a Calendar object.

Any help appreciated! Thanks!


Solution

  • Unfortunately you can't. The only way to get a list of calendars that the user has access to is though the calendarlist.list method. The issue with this is that you must be sure that all of the users' calendars were actually added to calendarlist which is not always the case.

    What you can do is prompt the user asking them to share with you any other calendars but that's not going to work very well with a service account.