MS Exchange (calendar)

Анатолий Горьков 21 Reputation points
2022-07-26T15:18:14.907+00:00

Please tell me how can I use webhooks and connectors (or other real time notifications) when working with Microsoft Exchange through EWS. For example, I need to update calendar contents. I am also interested in the existing restrictions on the number of requests (and so on) in my case.

Exchange | Exchange Server | Development
Exchange | Exchange Server | Management
{count} votes

Accepted answer
  1. Glen Scales 4,446 Reputation points
    2022-07-26T23:52:29.54+00:00

    EWS supports three types of notifications push, pull and streaming you can read more about them https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/notification-subscriptions-mailbox-events-and-ews-in-exchange . It doesn't support WebHooks if you using Office365 there are webhooks in the Graph you can use https://learn.microsoft.com/en-us/graph/api/subscription-post-subscriptions?view=graph-rest-1.0&tabs=http

    EWS and the Graph are throttled https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/ews-throttling-in-exchange and https://learn.microsoft.com/en-us/graph/throttling so there are limits on concurrency, EWS is more resource budget throttling where Graph is total number of requests.

    0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Анатолий Горьков 21 Reputation points
    2022-07-27T05:58:41.093+00:00

    @Glen Scales Thanks for the reply, I have a couple of clarifications left:

    1. Did I understand correctly that if I have integration with the calendar through the EWC, then for the maximum actualization (receiving) of the delta of the data user's calendar, I should choose a solution through Streaming notifications (from https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/notification-subscriptions-mailbox-events-and-ews-in-exchange) and consider restrictions (from https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/ews-throttling-in-exchange).
    2. Did I understand correctly that the option with WebHooks for Microsoft Graph (from https://learn.microsoft.com/en-us/graph/api/subscription-post-subscriptions?view=graph-rest-1.0&tabs=http) and Microsoft Teams (from https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/what-are-webhooks-and-connectors) won't work for my EWS situation?

  2. Анатолий Горьков 21 Reputation points
    2022-09-13T10:36:34.16+00:00

    Thank you very much, it became much clearer to me about the work of push notifications.

    Please help me understand one more thing, if these potential issues are possible when working with streaming notifications?:

    yes, however with push notifications there must be a clear communication channel between the Exchange CAS and your endpoint, this is where most of the problems in production come in, like firewalls or other network path devices blocking or using dynamic IP addresses, etc. Push -notifications are very hard to debug in production environments where you don't have access to the CAS server and you should generally avoid using them in Exchange Online (this and the backend are dynamic)

    and

    Notifications are queued on the Mailbox server, and subscriptions are stored on the Mailbox server. If the mailbox server that manages the subscription is unavailable, you will lose all new notifications, your mailbox will not sync, and you will have to re-subscribe to notifications.

    Or do stream notifications guarantee a more stable sync and the only drawback is that they are always open GET requests?


  3. Анатолий Горьков 21 Reputation points
    2022-09-14T21:30:20.663+00:00

    Thank you very much for the information about streaming notifications. Unfortunately, for technical reasons in our project, we cannot use stream notifications.
    I continue to configure push notifications and I have the following question:
    After subscribing to push notifications, I get an empty push notification, which I respond with SendNotificationResult with OK in the format from https://learn.microsoft.com/en-us/exchange/client-developer/web-service-reference/sendnotificationresult .
    But after that I still get empty push notifications. Do I understand correctly that if push notifications work correctly, then after my SendNotificationResult response with OK, I should receive notifications with events that occurred in my exchange calendar? If yes, what could I be missing?

    0 comments No comments

  4. Анатолий Горьков 21 Reputation points
    2022-09-12T20:58:23.59+00:00

    Thanks again for all the previous answers. I apologize in advance for such a voluminous question, but I would be grateful to receive answers to all the points that I do not understand.

    I started configuring the client via Rails using the Ongoing synchronization design pattern (https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/mailbox-synchronization-and-ews-in-exchange #synchronization-design-patterns) via push notifications (https://learn.microsoft.com/en-us/exchange/client-developer/web-service-reference/subscribe-operation?redirectedfrom=MSDN#comments). I successfully subscribe and successfully receive a post request to the configured client endpoint, but I did not fully understand the whole flow.
    Here are some questions to help me understand:

    1. Do I understand correctly that in the case of the path I have chosen, the step-by-step synchronization flow looks like this:
      a. set up an endpoint on the client to wait for push notifications as post requests
      b. subscribe to a push notification using the Subscribe operation (https://learn.microsoft.com/en-us/exchange/client-developer/web-service-reference/subscribe-operation?redirectedfrom=MSDN#push-subscription-request-example ). Save the watermark received in response on the client side in order to renew the subscription in future.
      c. after receiving a push notification, synchronize the calendar using the SyncFolderItems operation (https://learn.microsoft.com/en-us/exchange/client-developer/web-service-reference/syncfolderitems-operation?redirectedfrom=MSDN). Store on the client side the values ​​of all newly received SyncStates and use them in every future SyncFolderItems request. In response to a request with a push notification, send a successful 200.
      d. synchronize the calendar on the client with updates received via SyncFolderItems. Considering that SyncFolderItems does not return all the properties of the items, use GetItem to get them.
    2. In response to the subscription, I get the SubscriptionId and Watermark. The Watermark value is used to renew the subscription. When using a push subscription, is it necessary to use the SubscriptionId value? If yes, where is?
    3. After subscribing, I receive a push notification as a post request to the configured on the client endpoint. Is it normal that this post request is empty (without any parameters and values ​​included in it)? Do I understand correctly that the documentation https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/notification-subscriptions-mailbox-events-and-ews-in-exchange#ews-push-notifications describes that in push notifications I will receive events?
    4. Tell me where I can find Push Notification Sample Application? In https://learn.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/bb204063(v=exchg.140)?redirectedfrom =MSDN it is empty block.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.