We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Delete Email From the folder deleted Items

Hello,
i use this code to delete emails from the folder “Deleted Items” :
string uri=“https:xxxxxx”;
string domain=“eu”;
string userName=“xxxx”;
string password=“xxxxx”;
IEWSClient=EWSCliet.GetEWSClient(uri,userName,password,domain);
ExchangeMessageInfoCollection coll=client.ListMessages(client.MailboxInfo.DeletedItemsUri);
foreach(ExchangeMessageInfo msg in coll)
{
client.DeleteMessage(msg.UniqueUri);
}

the code is ok, but the messages are not deleted.
Any idea ?

Best reagrds,
Nacata

Hi Nacata,


Thank you for the feedback.

In order to delete the messages from the Deleted Items folders on an Exchange server, please use the overloaded form of DeleteMessage as follow:

client.DeleteMessage(msgInfo.UniqueUri, true);

The flag is used to permanently delete the messages from the deleted items folder. If it is not used in case of other folders, such as Inbox etc., the deleted items are sent to the “Deleted items” folder. Please try it at your end and let us know your feedback.