Google Calendar API - Fetch instances of recurring events where original recurring event exists in calendar

Viewed 50

I am currently working with Google Calendar API to fetch instances of recurring events, to retrieve the recurrence rule.

As suggested in https://stackoverflow.com/a/30505720/9524080, I am using singleEvents param while calling Events#list.

This allow me to fetch all instances of recurring events present in my calendar, while having a link to the original recurring event via recurringEventId.

By retrieving the event via this id, I am able to figure out the recurrence rule.

This is working as expected but there is an edge case.

When I am attendee of an instance of a recurring event while not being invited to the original recurring event, I can't use Events#get to retrieve the original recurring event, as it isn't present in my calendar (404 is thrown)

 ┌────────────────────────────────────────────────────┐  ┌────────────────────────────────────────────────────┐
 │                     My calendar                    │  │                     Calendar 2                     │
 │                                                    │  │                                                    │
 │  ┌──────────────────┐                              │  │  ┌──────────────────┐                              │
 │  │                  │                              │  │  │                  │                              │
 │  │  Recurring event │                              │  │  │  Recurring event │                              │
 │  │                  │                              │  │  │                  │                              │
 │  │        A         │                              │  │  │        B         │                              │
 │  │                  │                              │  │  │                  │                              │
 │  └──────────────────┘                              │  │  └──────────────────┘                              │
 │                                                    │  │                                                    │
 │  ┌──────────────────┐    ┌──────────────────┐      │  │  ┌──────────────────┐                              │
 │  │                  │    │                  │      │  │  │                  │                              │
 │  │  Instance of     │    │  Instance of     │      │  │  │  Instance of     │                              │
 │  │  recurring event │    │  recurring event │      │  │  │  recurring event │                              │
 │  │        A1        │    │        B1        │      │  │  │        B1        │                              │
 │  │                  │    │                  │      │  │  │                  │                              │
 │  └──────────────────┘    └──────────────────┘      │  │  └──────────────────┘                              │
 │                                                    │  │                                                    │
 │                                                    │  │                                                    │
 └────────────────────────────────────────────────────┘  └────────────────────────────────────────────────────┘

(I can fetch A via A1, but not B via B1 because I only have instance B1 in my calendar and not B)

Is there any way, while using Events#list to return a list of instances of recurring events that includes only the instances of the original recurring events available in my calendar ?

1 Answers

In terms of permissions, you are explicitly given permission to just one instance of a recurring event that will be interpreted as an isolated event (from the perspective of the invitee), therefore getting a 404 as an invitee while trying to use Events:get using the main event ID can be considered an expected behavior.

So all of this is pretty much expected because of how Google manages the permissions. Let's take Google Drive as an example. Let's say I have a folder that contains a couple of files and I give you access only to a specific file, but with this access you have you then try to list all the files from the folder. It will fail because you are not supposed to have access to the rest of the files.

References:

Related