i'm trying to fetch the list of all modified Outlook event instances in a certain time period using Microsoft Graph and the delta funcion.
When i call the the following endpoint:
/users/{userId}/calendars/{calendarId}/calendarView/delta?startDateTime={start}&endDateTime={end}
i get the list of all normal events with all their properties correctly set. But if there are recurring events, their occurrences only have these properties: #odata.type, #odata.etag, seriesMasterId, type, id, start, end.
The docs don't say anything about this. Should i read all the other properties from the master event?
Yes that's correct. Any property not set on the occurrence should be interpreted as having the same value as the master.
Related
I was trying following two queries and only 1st query give correct events results according the given date range.
Is there any reason for giving all events when i use me/events in 2nd request ?
1st
https://graph.microsoft.com/v1.0/me/calendarview?startdatetime=2020-07-02T10:20:52.032Z&enddatetime=2020-07-09T10:20:52.032Z
2nd
https://graph.microsoft.com/v1.0/me/events?startdatetime=2020-07-02T10:20:52.032Z&enddatetime=2020-07-09T10:20:52.032Z
Response of 2nd query
The startDateTime and endDateTime query parameters aren't used by the /me/events endpoint. Those are specific to /me/calendarview.
Calendar view requires a "time window", because it expands recurring events and returns an entry for each occurrence that happens between those times. If it wasn't bounded, this could result in infinite occurrences, since you can create recurring events with no end date :).
The /me/events endpoint doesn't expand recurring events, so it just returns the series masters and single-occurrences on the calendar.
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?
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.
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.
From the Graph Documentation:
if you want a calendarView for a specific time range you use the query
GET https://graph.microsoft.com/v1.0/me/calendar/calendarView?startDateTime=2017-01-01T19:00:00.0000000&endDateTime=2017-01-07T19:00:00.0000000
if you want a delta token to get the changes in a calendarView you use the query
GET https://graph.microsoft.com/v1.0/me/calendarview/delta?startdatetime={start_datetime}&enddatetime={end_datetime}
My problem is taht I need to get all the events from a specific date at the beginning of my program, but after that I'm interesting to track changes of events from another date.
So I'm wondering if is it possible to get a calendarView for a specific time range and a delta token for another time range in a single query?
It is not possible to do this in a single query. Please issue two separate queries.
Thanks!
Sri
is there a way to query for next 5 instances of given series? I am querying using time-frame:
1. ask for all the meetings for next 7 days for all user events
2. Go over each event fetched and check if event has masterSerieId
3. Return matching instances.
This feels (and is) a bit painful.
Can i request next X instances of master series right away? I can't just simply or 'simply' get them based on recurrence rule, as some might have expired.
I could image I could ask for a year ahead and pass as a query parameter masterSeriesId and limit output with $top. Is that right approach?
Based on this document, you could call /events//instances – given a start time, returns all instances in the requested time frame of the meeting specified by the provided series master ID
I use Redemption to go through some recurring appointments in Outlook and I can get the changed/deleted occurrences of these recurring appointments via the RDORecurrencePattern.Exceptions property.
What I really want to find out, is the index of these modified occurrences in the entire recurring series, this is the same index RDORecurrencePattern.GetOccurence(Index) uses to find the occurrence.
But it doesn't look like this property is exposed anywhere. Does anyone know any way to find this index?
No, such a property is not exposed unfortunately. The best you can do is loop through all occurrences and open each occurrence using RDORecurrencePatterm.GetOccurence passing an integer index, you can then compare the start date of the occurrence with the date of the given exception.