Using the Graph CLI, How can I find all events in a date range *including* recurring instances?

Bertalan, Tom 0 Reputation points
2025-02-13T16:34:08.3966667+00:00

I'm using a command like

mgc users events list --user-id me --filter "start/dateTime ge '2025-02-13T05:00:00Z' and end/dateTime le '2025-02-14T05:00:00Z'" 

to retrieve as JSON my events for a day. However, this only surfaces events that are unique to that day, or first instances of recurring events. How can I also get recurrences to be included?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,148 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Yakun Huang-MSFT 10,480 Reputation points Microsoft Vendor
    2025-02-14T02:24:07.23+00:00

    Hello Bertalan, Tom,

    Thank you for reaching out to Microsoft Support!

    For recurring events, you can use the List instances method, which lists instances of an event for a specified time range. The request command is as follows:

    mgc users events instances list --user-id {user-id} --event-id {event-id} --start-date-time "2019-04-08T09:00:00.0000000" --end-date-time "2019-04-30T09:00:00.0000000" --select "subject,bodyPreview,seriesMasterId,type,recurrence,start,end"
    

    See this document for more details:

    https://learn.microsoft.com/en-us/graph/api/event-list-instances?view=graph-rest-1.0&tabs=cli

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.


  2. Bertalan, Tom 0 Reputation points
    2025-02-27T19:18:50.74+00:00

    Well, I went ahead and wrote it this way. Get all the events ever, post process out the recurring ones, then, for each of those, do the users events instances list command to get recurrences in my actual desired time range. This requires way too many API calls, and the first one as I said basically redownloads the whole calendar every time the script is invoked, but it works, and takes only a couple minutes to run.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.