EWS Timing out Emptying Deleted Items Folder

Copper Contributor

Dear Team,

 

I am trying to empty my DeletedItems folder on Office365 through OWA. It just ignores my requests and next refresh I see still all emails are there. Outlook client takes a long time to download because in DeletedItems there are around 40 GB of emails.

 

Hence I wrote a small piece of console application 

 

using Microsoft.Exchange.WebServices;
using Microsoft.Exchange.WebServices.Auth;
using Microsoft.Exchange.WebServices.Data;

 

service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");

 

(Autodiscover takes a long time and hence caching this URL)

 

Folder fldDeletedItems = Folder.Bind(service, WellKnownFolderName.DeletedItems);
fldDeletedItems.Empty(DeleteMode.HardDelete, false);

 

And this .Empty line is throwing the following exception 

 


Additional information: The request failed. The operation has timed out

 

How do I go about emptying the DeletedItems folder?

 

Thanks and Regards,

 

Deepak 

1 Reply

I guess you can try deleting them in batches? Another thing that comes to mind is create/apply a retention tag to have those items deleted server-side.

 

Or open a support case and have them look at this, it's not like we didn't warn them the decision to remove the retention policy on the Deleted Items folder will cause problems with Outlook...