Reputation: 73
I need to Download Email Attachments from Exchange Server using Exchange Web Service API 2.1 I was tried FindItemResults. Minimum size of files can be download. but, If the file size is above 1 MB(I tried with 2MB file). It takes More time and throw Time expired Exception. I know Why this exception. But My question is, can I download big size of attachments?
Upvotes: 0
Views: 1239
Reputation: 112927
You should use GetItem, not FindItem. Use FindItem to get the Id och the mail with the attachment, then get the entire mail with GetItem.
Note that the FindItem operation only returns the first 512 bytes (255 Unicode characters) of any property; therefore, message header collections that are longer than 512 bytes will be truncated.
You can modify the code in this great answer to suit your needs: Exchange Web Services API : get mail attachments
Upvotes: 1
Reputation: 22032
The default timeout in the EWS Managed API is 90 seconds so if the download isn't completing in that time you'll get a time out exception thrown. You can just increase the timeout by setting the timeout property on the ExchangeService class eg
Service.Time = 300000;
300000 = 300000 milliseconds or 5 minutes
Cheers Glen
Upvotes: 1