I have to send auto reply emails when receiving a message in a shared mailbox and based on different reason sent the email. After the sent, I need to delete the email from the sent item folder. But when I try to delete it I get this message:
ExceptionAspose.Email.Exchange.ExchangeException: DeleteMessage failed. Response Code: ErrorCannotDeleteObject, MessageText: Object cannot be deleted.
var replyMessage = new MailMessage
From = this.autoReplyAddress,
To = email.From,
HtmlBody = emailInfo.ReplyEmail,
Body = emailInfo.ReplyEmail,
Subject = "RE: " + email.Subject
var credential = new NetworkCredential(mailboxUser,mailboxUserPSW,mailboxDomain);
ExchangeWebServiceClient client = new ExchangeWebServiceClient(this.mailboxConnection, credential);
var sentMessages = client.ListMessages(client.GetMailboxInfo().SentItemsUri);
foreach (var sentMessage in sentMessages)
if (sentMessage.Subject != null && sentMessage.Subject.Equals(msgSubject))
On the client.DeleteMessage I get the exception error.