Andrei Chirtes
Andrei Chirtes

Reputation: 43

Is it possible to get EWS streaming notifications from multiple servers continually?

I'm just starting out in the Office365, Exchange Online, EWS field, and I've been tasked with building a rather complex project.

I would like to know if it is possible to make an application that awaits a notification about an event on an Exchange (online) server, and then does something about it? To be more clear, here is an example: an admin logs in to my app, provides his connexion details, and then the app starts listening (opening and keeping a connexion alive with his Exchange server). Once a room has been booked in his organization, a function is executed, because my app is notified directly. I have a part of the code that connects to an Exchange (online) server, and does some actions on that server, by using the credentials and making requests.

So the question is: can my app stay connected to the streaming notifications flow of multiple servers simultaneously indefinitely?

Thank you!

Upvotes: 1

Views: 681

Answers (1)

pjneary
pjneary

Reputation: 1246

Short answer: yes it is. Longer answer: you need to manage the streaming notification connections carefully.

First off, particularly with O365, you will need to extract the Grouping Information (GI) for each SMTP address (from GetUserSettings during autodiscovery), group the various SMTPs according to their GI, subscribe to each, and then open the connection for that group of subscriptions. SMTPs can change GI at any time (e.g. overnight), so you might have to cancel a subscription for an SMTP and re-discover to get its new group, then add it onto another connection.

Second, depending on how many connections you will have to a specific server, you might need impersonation rights, unless your user will provide his credentials for his SMTP to your app. The max number of connections per userid without impersonation is around 20, and for O365 that is a hard limit.

You did not mention the numbers involved in your requirements or the duration of the subscription. If it's only a few users at any one time, or you can unsubscribe after a short while, then some of this complexity might be overkill.

Unfortunately, there's no central reference on streaming notifications, although MSDN has a good number of articles you can search for.

HTH

Upvotes: 1

Related Questions