0

I try to get event list from outlook with using Outlook REST API.
According to Microsoft document firstly; i need to subscribe outlook

Endpoint is: https://outlook.office.com/api/v2.0/me/subscriptions
It needs NotificationURL parameter to send notification when an event is changed.
I should implement a REST API(for NotificationURL) to pass outlook as parameter but i couldn't find any document.
What parameters should get my REST endpoint or what it is type(post,get,put etc...)
i appreciate your help
thank you!

My REST API Specifications that talk with Outlook API

can
  • 31
  • 2
  • 5

2 Answers2

0

If you wish to get a list of events you do not need to use subscriptions at all. Just use the procedure described here.

Victor Ivanidze
  • 397
  • 2
  • 7
  • I need to send push notification to user when an event is changed. So; i need to subscribe first. To subscribe outlook; outlook needs "subscriptionurl". Microsoft describes this url as: "Specifies where notifications should be sent to. This URL represents a web service typically implemented by the client.". But i could'nt any detail or example about this api(get,post) or what parameters it take? – can Jan 31 '19 at 09:10
  • Have a look at this: https://stackoverflow.com/questions/42222773/access-to-outlook-restapi-from-an-outlook-web-add-in – Victor Ivanidze Jan 31 '19 at 13:46
0

Microsoft has push notification api aka webhook for outlook events. For that you need to first register (create subscription for resource) webhook. check out below code snippet that allows to send notification when any event created or updated on notification url. doc here https://learn.microsoft.com/en-us/graph/webhooks#notification-endpoint-validation

POST https://graph.microsoft.com/v1.0/subscriptions Content-type: application/json { "changeType": "created,updated", "notificationUrl": "<YOUR-notification api endpoint>/api/notify", "resource": "me/events", "expirationDateTime":"2019-03-3T18:23:45.9356913Z", "clientState": "myOutlookEvents" }

You can use clientState to verify endpoint request that comes from MS Graph.

MS will POST data in below format

{
  "value": [
    {
      "subscriptionId":"<subscription_guid>",
      "subscriptionExpirationDateTime":2019-03-3T18:23:45.9356913Z",
      "clientState": "myOutlookEvents",
      "changeType":"created",
      "resource":"users/{user_guid}@<tenant_guid>/event/{long_id_string}",
      "resourceData":
      {
        "@odata.type":"#Microsoft.Graph.Event",
        "@odata.id":"Users/{user_guid}@<tenant_guid>/event/{long_id_string}",
        "@odata.etag":"W/\"CQAAABYAAADkrWGo7bouTKlsgTZMr9KwAAAUWRHf\"",
        "id":"<long_id_string>"
      }
    }
  ]
}

After this you need to get the event from id that received from graph api

Mangesh Bhapkar
  • 393
  • 1
  • 4
  • 8