0
votes

I have looked at the post of people saying the resolved this issue by allowing the API to accept "text/plain".

Even though I have done so, I am still getting the below error:

"{ \"error\": { \"code\": \"InvalidRequest\", \"message\": \"Subscription validation request failed. Notification endpoint must respond with 200 OK to validation request.\", \"innerError\": {
\"request-id\": \"ec325726-5b30-4cb1-bec5-3ba3debf88b0\",
\"date\": \"2020-03-23T13:02:01\" } }}"

I have tested my API on Postman using the same request Microsoft sends when they are validating an API. All seems to be fine in Postman.

The image shows Postman results:

The image shows Postman results

Please help.

1
Include your code snippet so that it can be reproducible. - Md Farid Uddin Kiron
POST graph.microsoft.com/v1.0/subscriptions Content-Type: application/json { "changeType": "updated", "notificationUrl": "https://<my api domanin>/api/Graph/ReceiveGraphNotification", "resource": "/users/mailboxSettings", "expirationDateTime": "2020-03-27T11:00:00.0000000Z", "clientState": "SecretClientState" } - Mteteleli Vas
The listener: [HttpPost("ReceiveGraphNotification")] [Produces("text/plain")] public async Task<ActionResult<string>> ReceiveGraphNotification(string validationToken) { using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8)) { string response = await reader.ReadToEndAsync(); return Content(validationToken, "text/plain"); } } - Mteteleli Vas
Can you test your service again with the validation request under the misc folder of this collection? It is fine tuned to reflect the query sent by the graph and contains unit tests to validate each aspect and help narrow down the issue. github.com/microsoftgraph/microsoftgraph-postman-collections - baywet
I did run it under the misc folder on postman and all the tests passes with no errors. PASS Status test PASS Content type test PASS Response body test - Mteteleli Vas

1 Answers

1
votes

Subscribing to user's mailbox settings for change notifications is not supported at the moment by Microsoft Graph. If you'd like to request support for such feature, please go to uservoice and create/upvote an idea.
If it were to be added to supported resources for change notifications, it more than likely that the resource would be /users/{userid}/mailboxsettings as /users/mailboxsettings is not a valid resource on Microsoft Graph. (resources for subscriptions follow the same pattern as the URLs of the APIs)