Free Support Forum - aspose.com

Delete Email from Sent Folder with EWS

Hello,
I Create one “MailMessage” and I send it with EWS client.
I have Exchange 2013.

After sending, I need to delete the message in sent folder of my Exchange account.
How can I get “UniqueUri” of sent message? I don’t want search in “Sent Folder” by “subject” or “sender”.

My idea:
Dim myMail as new MailMessage
’ set all properties of MailMessage…
Dim credential As NetworkCredential
’ set all properties of credential …

Dim client = EWSClient.GetEWSClient(“https://owa.xxxx.com/ews/exchange.asmx”, credential)
client.Send(myMail) ’ In my opinion “Send” method should retrieve UniqueUri of message in Exchange.

’ with UniqueUri I can Delete Message
client.DeleteMessage("…uniqueUri…")

Thanks!

@moriammsis,

Thank you for writing to Aspose support team.

UniqueUri or MessageId can be retrieved by searching the messages using some query or by iterating through all the messages in the sent folder. I am afraid that there is no other method available to get UniqueUri of the sent message other than searching it. Please feel free to write us back if you have any other query in this regard.

Hello,
thanks for your reply.

My app sends every day some mails with the same Subject and same body.
How can I identify one mail sent if I don’t have UniqueUri?

Can you implement a new feature that “Send” method return UniqueUri?

Any ideas?

Can I send mailmessage via Exchange but no save in sent box?

Thanks

@moriammsis,

Feature request for getting sent item’s URI via EWS has been logged as EMAILNET-38968. We’ll let you know once we investigate the possible implementation of such feature.

Regarding avoiding of sent items to sent box, can you try the solution mentioned here and see if it helps? This is somewhat that is related to Exchange server settings and not to API.

The issues you have found earlier (filed as EMAILNET-38968) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by kashif.iqbal