How to get cancelled and exceptional occurrences of a recurring event in Microsoft Graph API

Create occured event

Let's start by creating a recurring event.

POST https://graph.microsoft.com/v1.0/me/events

{
  "subject": "Let's go for lunch",
  "body": {
    "contentType": "HTML",
    "content": "Lunch time"
  },
  "start": {
      "dateTime": "2025-05-26T12:00:00",
      "timeZone": "Central Europe Standard Time"
  },
  "end": {
      "dateTime": "2025-05-26T12:30:00",
      "timeZone": "Central Europe Standard Time"
  },
  "recurrence": {
    "pattern": {
      "type": "daily",
      "interval": 1
    },
    "range": {
      "type": "endDate",
      "startDate": "2025-05-26",
      "endDate": "2025-05-30"
    }
  },
  "location":{
      "displayName":"Pub"
  },
  "attendees": [],
  "allowNewTimeProposals": true
}

The response contains the id which is the unique identifier of the master series.

Get cancelled occurrences and exceptional occurrences

Now in Outlook, I will cancel the event on 5/29/2025 and change the start time of the event on 5/28/2025.

Recently, Microsoft Graph API has added the ability to get cancelled and exceptional occurrences of a recurring event. You can use the cancelledOccurrences property and the exceptionOccurrences relationship.

First of all, you need to specify the exceptionOccurrences and cancelledOccurrences in the $select query parameter and you need to expand the exceptionOccurrences.

GET https://graph.microsoft.com/v1.0/me/events/{masterSeries_id}?$select=subject,start,end,occurrenceId,exceptionOccurrences,cancelledOccurrences&$expand=exceptionOccurrences

The response

{
    "id": "AAMkAGRkZTFiMDQxLWYzN...i2ZIVhDiHAAq5zGN4AAA=",
    "subject": "Let's go for lunch",
    "cancelledOccurrences": [
        "OID.AAMkAGRkZTFiMDQxLWYzN...i2ZIVhDiHAAq5zGN4AAA=.2025-05-29"
    ],
    "start": {
        "dateTime": "2025-05-26T10:00:00.0000000",
        "timeZone": "UTC"
    },
    "end": {
        "dateTime": "2025-05-26T10:30:00.0000000",
        "timeZone": "UTC"
    },
    "exceptionOccurrences": [
        {
            "id": "AAMkAGRkZTFiMDQxLWYzN...mSFYQ4hwAKucxjeAAAEA==",
            "subject": "Let's go for lunch",
            "start": {
                "dateTime": "2025-05-28T09:30:00.0000000",
                "timeZone": "UTC"
            },
            "end": {
                "dateTime": "2025-05-28T10:00:00.0000000",
                "timeZone": "UTC"
            }
        }
    ]
}

As you can see, the exceptionOccurrences is a list of events that are exceptions to the master series, and the cancelledOccurrences contains the occurrenceId property values of canceled instances in a recurring series.

What if you want to get details about the cancelled occurrences?

You can parse the date from the occurrenceId which has the following format: OID.{masterSeries_id}.{date}. The date is in the format yyyy-MM-dd, so you can get only the date when the occurrence was cancelled.

0
Buy Me a Coffee at ko-fi.com
An error has occurred. This application may no longer respond until reloaded. Reload x