How to find recurrence exceptions through Microsoft Outlook Calendar Graph API
Asked Answered
F

2

9

I'm currently using the Microsoft Graph API to sync calendar events to my local application. On my end, I don't care to save each individual occurrence in a series, but prefer instead to just save the series master and then extrapolate out the instances of the series myself. For this reason, I am using the /me/events call rather than the /me/calendarView call.

My problem is when editing a single occurrence in a series. After editing the single occurrence, I make the /me/events call and I can see the newly added "Exception" type -- which is great. However, I don't see how to relate that new event back to which occurrence was changed to cause the exception.

For example, if I have a weekly meeting on Monday at noon, and I change today's meeting from noon to 2:00, it's pretty easy to tell that today's meeting is the one that changed. But if I change today's meeting to Friday, how can I tell that it was today's meeting that changed and not next week's? Keep in mind that I am only storing the master, and not every single calendarView occurrence.

Another example is if I delete an occurrence. In this case, the /me/calendarView call will simply not return that occurrence anymore. No exception type is generated. And the series master returned from the /me/events call doesn't change at all to indicate that a date is missing.

The format that I'm used to is something like the iCal/vCal format, where there is a start date, end date, and then a list of exception dates. Using that format, I can easily tell from the series master which dates to skip, without needing to "render" the entire occurrence and skip the exceptions. And if an occurrence is deleted, it is added to the EXDATE list and then it is never considered on rendering. Does the Microsoft Graph API not have an easy way to see these changed/deleted occurrences?

Funest answered 23/7, 2018 at 17:46 Comment(5)
hi, how do you edit/delete a single occurrence in the first place? Trying to do the same thing but can't find any docs or examples on that so far. Appreciate any input on that.Downhill
Just click on one of the occurrences in your Outlook calendar and edit it. It will ask you if you want to edit the entire series or just the single instance.Funest
oh, I assumed you did that via graph api, that what I was looking for. Anyway, figured that out alreadyDownhill
That's a legit question, @Bobby. I had gone through the similar situation recently, so ended up saving all the recurrences amid our customer was screaming at us saying it should be very easy to do.Internationalize
After you've performed a GET for the series master, you would look at the exceptionOccurrences property, which could contain all the modified events with their originalStart date pointing to the date & time before it was modified. The occurrenceId would also refer to the original date. For deleted occurrences, you can obtain a list from cancelledOccurrences for the series master, which would give you the dates that have been cancelled.Hudnut
M
3

I was having a similar issue, but I think I've now realized that Microsoft does not allow recurring events to move later than the next instance, or earlier than the preceding one (at least while using Outlook calendar in the browser). So you can always assume that the 3rd event is 3rd in the series, the 4th is 4th, etc.

So as long as you know the series number, you can locate it by getting all of the instances with /me/events/[event_id]/instances?startDateTime=[start_date_time]&endDateTime=[end_date_time].

The error in Outlook Calendar when I do this isn't very clear, so maybe something else is up, but I am able to move the exception events otherwise. Unfortunately, I'm not sure if there's a definite way to know what end_date_time to use, as events can be moved indefinitely later.

Mesothorax answered 27/6, 2019 at 22:41 Comment(0)
E
-1

Based on the response object from the event marked as an exception, you can use the seriesMasterId to relate the exception to its parent recurrence.

Ebonieebonite answered 11/10, 2018 at 18:4 Comment(1)
Thanks for your input. My problem, however, isn't with being able to relate the event to the master; it's with being able to relate the exception to which occurrence it's supposed to be replacing.Funest

© 2022 - 2024 — McMap. All rights reserved.