Robson Hermes
Robson Hermes

Reputation: 435

Why are edited instances of recurrent events listed when using singleEvents=false in Google Calendar?

I created one recurrent event, repeats for 3 days.

Then when I search using:

calendarService.events().list("primary").setTimeMin(min).setTimeMax(max).setSingleEvents(false).setShowDeleted(false).execute();

I get only the underlying recurrent event:

Event ID: cq61agdr4sbdnfj7rfbpbk2pro 
Summary: Google Calendar API test event 
Status: confirmed 
Event Start/End: {"dateTime":"2017-05-17T15:24:53.000+02:00","timeZone":"Europe/Berlin"} {"dateTime":"2017-05-17T16:24:53.000+02:00","timeZone":"Europe/Berlin"}
Recurrence: [RRULE:FREQ=DAILY;COUNT=3]
RecurringEventId: null

So far so good, but when I edit (through Google Calendar web page) only one of the recurrences, and repeat the same previous search, I also get the edited event (the second one, you can see I changed the summary):

Event ID: cq61agdr4sbdnfj7rfbpbk2pro 
Summary: Google Calendar API test event 
Status: confirmed 
Event Start/End: {"dateTime":"2017-05-17T15:24:53.000+02:00","timeZone":"Europe/Berlin"} {"dateTime":"2017-05-17T16:24:53.000+02:00","timeZone":"Europe/Berlin"}
Recurrence: [RRULE:FREQ=DAILY;COUNT=3]
RecurringEventId: null

Event ID: cq61agdr4sbdnfj7rfbpbk2pro_20170518T132453Z 
Summary: foo bar Google Calendar API test event  
Status: confirmed 
Event Start/End: {"dateTime":"2017-05-18T15:24:53.000+02:00","timeZone":"Europe/Berlin"} {"dateTime":"2017-05-18T16:24:53.000+02:00","timeZone":"Europe/Berlin"}
Recurrence: null
RecurringEventId: cq61agdr4sbdnfj7rfbpbk2pro

Why I get an instance of recurrent event in a query with setSingleEvents(false) after the instance is changed?

Upvotes: 1

Views: 218

Answers (1)

AL.
AL.

Reputation: 37778

This is the expected behavior. Haven't found docs that explicitly explains the behavior of calendar events, but basing from the details you provided and the parameter's description:

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.

If an instance of a recurring event is modified, it would be treated as different than the usual recurring event (i.e. single one-off event), making the Recurrence null, which I presume is parameter that is checked if an event is eligible to be returned for singleEvents and the RecurringEventId is used to trace from which recurring event it was originally from.

Upvotes: 2

Related Questions