Shubham
Shubham

Reputation: 108

Folder.Bind() Stuck when using Subscriptions for multiple accounts through EWS Managed API

I am using a streaming subscription (EWS Managed API) to subscribe to events on one mailbox. Now, instead of doing this directly, I want to subscribe and take action on incoming mails on these mailboxes through impersonation. How to achieve it?

What I have Tried:

I did setup multiple streaming subscriptions using service.ImpersonatedUserId() but when i get a event(i get events successfully for the 2 mailboxes i have subscribed to) and try to take some action for e.g EmailMessage.Bind(Item Id) or Folder.Bind(), the code stucks! I dont get any error message. I even tried TraceEnabled= true, I found nothing!

I did see this MSFT link but didn't find an answer. I need help with for e.g moving the mail to another folder for multiple mailboxes through EWS subscriptions.

Upvotes: 1

Views: 466

Answers (1)

Glen Scales
Glen Scales

Reputation: 22032

The default concurrent connection limit in .net is 2 by default https://learn.microsoft.com/en-us/dotnet/api/system.net.servicepointmanager.defaultconnectionlimit?view=netframework-4.7.2 because Streaming notifications require a concurrent connection to work this is a common issue.So all you should need to do is set the connection limit higher eg

System.Net.ServicePointManager.DefaultConnectionLimit = 100;

Upvotes: 4

Related Questions