question

JrgenIversen-5659 avatar image
1 Vote"
JrgenIversen-5659 asked Danstan-MSFT commented

Error on adding subscription on events using MS Graph

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-sdkmicrosoft-graph-calendar
· 8
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I am also facing exactly same issue...let me know if you found some solution for this,

1 Vote 1 ·

Please check this thread and see if the insights there can help.


0 Votes 0 ·

It is actually me who created that thread on SO, but the suggestions didn't help and I don't understand how it is possible for me to read and create events in the users calendar but not add a subscription on changes to events in the same calendar if this is a policy or permission issue.

1 Vote 1 ·
Danstan-MSFT avatar image Danstan-MSFT JrgenIversen-5659 ·

Let me look in to this further and get back to you.

0 Votes 0 ·
Show more comments

Try to create subscription for personal contacts, using Graph, got exact the same error (different ids of course).
Just for test, changed the value of Resource from "me/contacts" to "me/messages", for which I don't have permission, then I got error like :

 {
     "error": {
         "code": "ExtensionError",
         "message": "Operation: Create; Exception: [Status Code: Forbidden; Reason: Access is denied. Check credentials and try again.]",
         "innerError": {
             "date": "2021-06-09T12:52:16",
             "request-id": "...",
             "client-request-id": "..."
         }
     }
 }

Which is logical, permission issue. But when I change Resource back to "me/contacts", the creation worked. Don't remember that I changed sth else, magic ?

0 Votes 0 ·

Got the same issue. Syncing calendars through API. Creating and reading events works but not creating subscription, but only for some users. Would like to have some tips what to advise the customers as this seems like misconfiguration on their side.

0 Votes 0 ·
SibiSharanyan-3915 avatar image
0 Votes"
SibiSharanyan-3915 answered

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DavidP-9609 avatar image
0 Votes"
DavidP-9609 answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.