server cannot process this request error by EWS using c#
I'm getting the below error when i try to read the email using exchange web service.
The error message is " server cannot process this request now"
The error exactly pops at this line of code shown below:
var email = EmailMessage.Bind(_service, findItemsResult.Id, emailProps);
where the actual code is given below:
_service is an exchange service
var view = new ItemView(100);
var userMailbox = new Mailbox(userMailbox);
var folderId = new FolderId(WellKnownFolderName.Inbox, userMailbox);
SearchFilter sf = new SearchFilter.SearchFilterCollection(LogicalOperator.And,
new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false));
var findResults = _service.FindItems(folderId, sf, view);
var emailProps = new PropertySet(ItemSchema.MimeContent, ItemSchema.Body,
ItemSchema.InternetMessageHeaders);
Parallel.ForEach(findResults, findItemsResult =>
{
var email = EmailMessage.Bind(_service, findItemsResult.Id, emailProps);
// do some other activity here
}