0

I want to get a list of shared (not primary or resource) Calendars through Google Calendar API for PHP. I tried the following:

(...)
$service = new Google_Service_Calendar($client);
(...)
$calendarList = $service->calendarList->listCalendarList();

I get three types of results in Array/Object

[id] => code@subdomain.domain.ext

  • Primary Calendar, username@domain.ext
  • Shared Calendar, code@group.calendar.google.com
  • Resource Calendar, code@resource.calendar.google.com

These are only distinguishable by their $key (id) and I could filter Shared Calendar by $value "group.calendar.google.com" however I think this can be done with more clean coding or by using a built-in method.

Is there any other way to only get Shared Calendars?

MKZ
  • 166
  • 1
  • 12
  • if it's not mentioned in the documentation, which, as far as I can see, it's not, then probably not, unfortunately. Not everything is exposed by the API – ADyson May 04 '18 at 08:58
  • @ADyson. Thanks for your answer. But is there any other way to distinguish a shared calendar from a resource calendar? It seems that only the ID is different – MKZ May 04 '18 at 10:25
  • As I already said, no. The relevant info is just not exposed through the API as far as I can see. Nothing in https://developers.google.com/calendar/v3/reference/calendarList or https://developers.google.com/calendar/v3/reference/calendars looks relevant to me, unless possibly the "kind" property on the calendar object gives it a way - what does that return? I think it probably just returns "calendar" every time, but maybe worth checking. – ADyson May 04 '18 at 10:27
  • @ADyson [kind] => calendar#calendarListEntry – MKZ May 04 '18 at 15:20

0 Answers0