问题
I have a working application that receive email webhook events from MS-Graph Api. I noticed that I could not find the subscription back using the subscriptionId, I get a 404 error.I also cannot delete the subscription using the id.
I investigated further and noticed that I cannot create new subscriptions anymore: The Application registered in Azure AD is a service-application (daemon)
My application auto renews the subscriptions and every time it did that I get a 202 response, but somehow the the subscription gets lost.
Request:
POST: https://graph.microsoft.com/beta/subscriptions
{
"changeType": "created,updated,deleted",
"notificationUrl": "https://myapi.azurewebsites.net/GraphWebhook/Inbox",
"resource": "Users/myemail@company.nl/mailFolders('inbox')/messages",
"expirationDateTime":"2016-10-25T20:23:45.9356913Z",
"clientState": "subscription-identifier"
}
Response:
"error": {
"code": "ExtensionError",
"message": "Operation: Create; Exception: [Status Code: NotFound; Reason: Not Found]",
"innerError": {
"request-id": "681ac550-be6f-4882-9b6b-e089c36ad38e",
"date": "2016-10-25T10:13:25"
}
Does anyone have any ideas?
UPDATE: Working now again out of the blue.
回答1:
The API supports both user id and user email address as part of resource path and it DOES NOT change. To check whether it is API issue or resource issue, you could try to access your resource using graph explorer:
GET https://graph.microsoft.com/beta/users/myemail@company.nl/mailFolders('inbox')/messages
Regarding the error you saw when creating subscription, it looks like an Exchange issue related to this.
Hope this helps.
来源:https://stackoverflow.com/questions/40237578/microsoft-graph-api-webhook-subscription-via-rest-api-not-working-anymore