Error on adding subscription on events using MS Graph

Jørgen Iversen 11 Reputation points
2021-06-01T07:03:12.423+00:00

I am using the MS graph subscription endpoint (https://graph.microsoft.com/v1.0/subscriptions) to add a subscription on a calendars events for some of my end users outlook accounts. For some accounts (not all) this fails with this error:

{
  "error": {
    "code": "ExtensionError",
    "message": "Operation: Create; Exception: [Status Code: ServiceUnavailable; Reason: Target resource 'xxxx-xxx-xxx-xxxx' hosted on database 'xxxx-xxx-xxx-xxxx' is currently on backend 'Unknown']",
    "innerError": {
      "date": "2021-05-31T08:27:37",
      "request-id": "c7c38d7a-617c-4601-9684-0f924e86248a",
      "client-request-id": "c7c38d7a-617c-4601-9684-0f924e86248a"
    }
  }
}

Just before adding the subscription my code have been able to add a new event to the same calendar, so I think that my access token has the right permissions to access the calendar. So I don't understand how I can get an "ExtensionError"?

Here is the C# code that I run to try to add the subscription:

var subscription = new Subscription
{
    ChangeType = "created,updated,deleted",
    NotificationUrl = GetNotificationUrl(),
    Resource = $"me/calendars/{calendarId}/events",
    ExpirationDateTime = DateTimeOffset.Now.AddHours(70),
    ClientState = clientState,
};

await graphServiceClient
    .Subscriptions
    .Request()
    .Header("Prefer", $"IdType=\"ImmutableId\"")
    .AddAsync(subscription);
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,916 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Sibi Sharanyan 21 Reputation points
    2021-08-18T05:15:15.76+00:00

    Running through the same issue with Outlook calendars, Any way tor esolve this ?

    0 comments No comments

  2. David P 1 Reputation point
    2021-09-07T07:34:28.353+00:00

    I fixed this by removing the "clientState" property in my request body. I was using json escaped body as a string, so maybe the API was having a tough time dealing with it.

    0 comments No comments