1
votes

I am integrating Outlook Office 365 in my web app. I want my app to remain in sync with Office 365 if there is any create/update event in the calendar.

Currently I have created one-way sync process, like create, update, delete, and get all events from calendar. The problems are:

  1. how to make two-way syncing with Office 365 for our app?
  2. How to create notification subscription?
  3. how to authenticate Notification-URL for subscription?

When we subscribe for notification callback, the returned message through exception with this Notification URL https://webapp.com/notifications?validationtoken=MmJiM2QwMjYtNjAxYi verification failed.

The question is how we will verify Notification-ULR? I have created app on Window Azure and when i subscribe return same error message. How i fix this?

Following code for subscription:

URL: https://outlook.office365.com/api/v2.0/me/subscriptions

    json_object = {
            "@odata.type":"#Microsoft.OutlookServices.PushSubscription",
            "Resource":"https://outlook.office365.com/api/v2.0/Me/Events",
            "NotificationURL":"https://webapp.com/notifications“,
            "ChangeType":"Created, Updated, Deleted",
            "ClientState":"36228645-58b5-4d73-98a6-1b9ac535680c"
        }
1

1 Answers

0
votes

https://dev.outlook.com/RestGettingStarted/Concepts/Webhooks

The Outlook notifications service validates the notification URL in a subscription request before creating a new subscription which occurs as follows:

  1. Outlook notifications service sends a POST to the notification URL: POST https://{notificationUrl}?validationtoken={TokenDefinedByService} ClientState: {Data sent in ClientState value in subscription request (if any)}

  2. Webhooks service must provide a 200 response with the validationtoken value in its body as type plain/text within 5 seconds. The validation token is a random string that should be discarded by the webhook after providing it in the response.