4
votes

I am creating an event with recurrence in Outlook Calendar and want to retrieve its full specification through API.

For example, the event repeats every weekend for a year. However, I removed some of the weekends from the time line, creating an exception to a recurrence rule.

How can I get these excluded dates through the API? When I receive a response with events from Outlook Calendar API I can not find an entry with excluded days.

Response with recurrence from Outlook Calendar API:

"recurrence": {
                "pattern": {
                    "type": "weekly",
                    "interval": 1,
                    "month": 0,
                    "dayOfMonth": 0,
                    "daysOfWeek": [
                        "saturday",
                        "sunday"
                    ],
                    "firstDayOfWeek": "monday",
                    "index": "first"
                },
                "range": {
                    "type": "endDate",
                    "startDate": "2017-08-19",
                    "endDate": "2018-01-30",
                    "recurrenceTimeZone": "FLE Standard Time",
                    "numberOfOccurrences": 0
                }
            },
1

1 Answers

0
votes

On the event object, there's a type property that has values including SingleInstance, Occurrence, Exception and SeriesMaster.

If you have the event ID of the series, you should be able to query exceptions like this: https://graph.microsoft.com/v1.0/me/events/[series id]/instances?startdatetime=2017-08-14T16:35:08.284Z&enddatetime=2017-08-18T16:35:08.284Z&$filter=type eq 'Exception'

According to the docs for listing event instances, this returns "occurrences and exceptions of the event in the specified time range".

Update: This might not actually work. I'm testing this now and the call returns a 200 status code, but an empty array of event exceptions. I'll investigate and update this when I learn more.