4
votes

I am using google calendar api v3 to fetch calendar events. But how to fetch all the recurring events. It just return single event with some hint like: DAILY;UNTIL=20 etc. Please help me out with this...

2
Please post your code - what have you tried already? - Albert Xing

2 Answers

16
votes

If you are using the Events: list API method, add the singleEvents=true parameter. From the API docs:

singleEvents

boolean

Whether to expand recurring events into instances and only return single one-off events and instances of recurring events, but not the underlying recurring events themselves. Optional. The default is False.

3
votes

If the event is a recurring event. You need to call another function in the API with the event ID and that will then return all the instances.

What does this mean 1) you get a normal even listing from the API. 2) then if you find an event that has ReccurenceID/Recurrence you can call the following with the EVENT ID. You can also specify parameters that you want to just like when searching for normal events (almost)

GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId/instances

Here is a nice blog post on it. http://googleappsdeveloper.blogspot.com/2011/12/calendar-v3-best-practices-recurring.html

The google API page is at: https://developers.google.com/google-apps/calendar/v3/reference/events/instances

Cheers

Peter