Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dealing with EWS throttling policies

What is an effective way of dealing with EWS throttling policies?

I'm attempting to read every email in my mailbox as well as download all attachments. The issue I'm encountering is that Exchange will often return an exception saying The server cannot service this request right now. Try again later.. Seems pretty self-explanatory, I must have hit my limit. Searching around I can see that this error is most likely caused by exeding how much time I spend per minute working with the CAS. The throttling policy appears to be EWSPercentTimeInCAS.

Since I can only receive 1,000 emails per query and I need to query for all 57,000~ emails. How can I make this work?

Note that I'm not attempting to circumvent the throttling policy. The only idea that comes to mind is to issue a Thread.Sleep(30000) statement every time I retrieve 1,000 emails (my search result limit). Not ideal however should work since fetching 1,000 items takes far less time.

This issue seems to stem from downloading attachments. The mailbox has 7,000~ attachments in total.

like image 418
gcso Avatar asked Nov 10 '11 18:11

gcso


People also ask

What is EWS throttling policy?

Throttling in Exchange helps to ensure server reliability and uptime by limiting the amount of server resources that a single user or application can consume. Throttling is a reactive response to overuse of system resources that may affect service reliability and functionality.

What is a throttling policy?

The throttling policy in Exchange is a protection mechanism for the Exchange server to ensure that the server's resources are not drained by a small number of users.


1 Answers

Your approach is correct. You'll need to slow down your number of requests per minute. See http://blogs.msdn.com/b/mstehle/archive/2010/11/09/ews-best-practices-understand-throttling-policies.aspx for more info on this topic.

like image 194
Henning Krause Avatar answered Sep 21 '22 09:09

Henning Krause