calendarmicrosoft-graph-apioffice365office365apimicrosoft-graph-calendar

How to get instances of recurrent calendar event for Microsoft Graph


I need to get all calendar events in a certain time period (for example last two weeks). How can I get instances of recurrence meeting for this time period, if this recurrent meeting was created for example several years ago? I know, that I can to get the ID for the recurring series master item and load instances of this item, but if this item was created several years ago, I have to load all meetings, find recurring series master items and after that try to find instances of these items in interested time period. Is there an easier approach?

I tried method GET /users/{id | userPrincipalName}/calendar/events to get list of calendar events, after that if I got recurring event, I can get instances of this event using such method https://learn.microsoft.com/en-us/graph/api/event-list-instances?view=graph-rest-1.0&tabs=http. But I want to find easier approach for my case.


Solution

  • I need to get all calendar events in a certain time period (for example last two weeks). How can I get instances of recurrence meeting for this time period,

    Typically for that you would use the CalendarView endpoint https://learn.microsoft.com/en-us/graph/api/user-list-calendarview?view=graph-rest-1.0&tabs=http

    https://graph.microsoft.com/v1.0/me/calendarView?startDateTime=2023-04-01T26:00:00-08:00&endDateTime=2023-04-31T19:00:00-08:00
    

    This would expand any recurring appointments within that time range