Hi,
I am following the steps mentioned in the given forum: https://github.com/microsoftgraph/aspnet-webhooks-rest-sample.
I am using ngrok for the localhost endpoints. I have updated the keys like client id, client secret key, notificaiton url in the web.config. The app is registered in Azure Active Directory.
While sending request to the microsoft graph to subscribe to users email,
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, subscriptionsEndpoint);
Subscription subscription = new Subscription
{
Resource = "me/mailFolders('Inbox')/messages",
//Resource = "me/events",
ChangeType = "created",
NotificationUrl = ConfigurationManager.AppSettings["ida:NotificationUrl"],
ClientState = Guid.NewGuid().ToString(),
//ExpirationDateTime = DateTime.UtcNow + new TimeSpan(0, 0, 4230, 0) // current maximum timespan for messages
ExpirationDateTime = DateTime.UtcNow + new TimeSpan(0, 0, 15, 0) // shorter duration useful for testing
};
I am getting below error:
An error occurred while processing your request.
NotFound
{
"error": {
"code": "ExtensionError",
"message": "Operation: Create; Exception: [Status Code: NotFound; Reason: Not Found]",
"innerError": {
"request-id": "de7d32c4-b634-4193-b06e-adb614b86ec7",
"date": "2018-04-09T18:02:45"
}
}
}
When i inspect in the ngrok web interface: http://127.0.0.1:4040/inspect/http
I see below response:
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: plain/text; charset=utf-8
Server: Microsoft-IIS/10.0
X-AspNetMvc-Version: 5.2
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?QzpcV29ya1xhc3BuZXQtd2ViaG9va3MtcmVzdC1zYW1wbGUtbWFzdGVyXGFzcG5ldC13ZWJob29rcy1yZXN0LXNhbXBsZS1tYXN0ZXJcR3JhcGhXZWJob29rc1xub3RpZmljYXRpb25cbGlzdGVu?=
X-Powered-By: ASP.NET
Date: Mon, 09 Apr 2018 18:00:13 GMT
Content-Length: 48
NjE3MTc4MjItZDllNi00ZDcwLThiZDYtYmU1YTlkMDUzZTAz - This is the validation token
How to fix this error ? What am i doing wrong in this ?