0

I'm using EWS stream subscription to get events from many mailboxes(500 above). But the maximum lifetime of a connection is 30 min. And the reconnection takes some time depends on the number of mailboxes. My doubt is How to handle this delay. ie We won't get the events that happened in between the Disconnection and re-subscription.

How to make this event subscription more stable.

Hope someone can help me..

Sumith Jose
  • 167
  • 8

2 Answers2

0

I have never tried it but you can set the subscription duration :

StreamingSubscriptionConnection connection = new StreamingSubscriptionConnection(service, 30);
KMarron
  • 503
  • 1
  • 6
  • 15
  • Yes, I used that. My need is to make the subscription alive for all time(365 days). So after this 30 min lifetime, we need to re-subscribe all mailboxes. This resubscription takes little time. And we won't get the event's in between that time. How to handle this interval. ie How to enable code to receive the event's full time without any failures. – Sumith Jose Jun 26 '20 at 14:07
  • Perhaps check this thread : https://stackoverflow.com/questions/6377085/increasing-the-lifetime-element-for-ews-streaming-subscription-connection – KMarron Jun 29 '20 at 14:00
0

You should use SyncFolderItems operation before any subscription to the mailbox

SyncFolderItems operation

and manage to save the SyncState at every call to the operation for not to resynchronize with the same items, look into the Next Step section of this documentation:

https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-stream-notifications-about-mailbox-events-by-using-ews-in-exchange#bk_nextsteps

supermyz
  • 91
  • 1
  • 6