1
votes

Im using the Microsoft Graph to get calendar event with application permission. It works perfectly. Now Im trying to set up a subscription to listen to event changes however the normal v1.0 do not suport this. However beta, at least in the description, say it works.

From the page: https://graph.microsoft.io/en-us/docs/api-reference/beta/api/subscription_post_subscriptions

"Note: the /beta endpoint allows Application permissions as a preview feature for most resources."

So I tried this with the URL: https://graph.microsoft.com/beta/subscriptions

Sending in a json object like this:

{ "changeType":"created,updated,deleted", "notificationUrl":"https%3A%2F%2FXXX.com%2Fo365.php", "resource":"%2Fusers%2Fooom%40xxx.com%2Fevents", "clientState":"1486588355561", "expirationDateTime":"2018-11-20T18:23:45.9356913Z" }

Doing this I get the result:

{ "error": { "code": "BadRequest", "message": "Resource not found for the segment '/users/[email protected]/events'.", "innerError": { "request-id": "d9ca58b1-ee1f-4072-81d5-0f1a25dcdd45", "date": "2017-02-08T21:26:51" } } }

I have tried all types of combos in the resource but cant get it to work. Anybody that have an idea on how to do this?

1

1 Answers

-1
votes

The value of json properties don't need to be url encoded. The resource also doesn't need a '/' in front of "users" (although this isn't what is causing your issue).

Try changing your JSON to:

{ "changeType":"created,updated,deleted", "notificationUrl":"https://myurl.com/o365.php", "resource":"users/[email protected]/events", "clientState":"1486588355561", "expirationDateTime":"2018-11-20T18:23:45.9356913Z" }

Feel free to respond back if this doesn't address the issue.