Update a message in Drafts Folder

Hi,

We have a message in our Drafts folder and we want to update it. Is there any way we can update the message in the drafts folder?

Hi Aaron,

You may please use following sample code which performs the following tasks:

  • Retrieve messages from drafts folder
  • Modify it
  • Delete old message
  • Append modified message

There is no function available which simply updates a message. You have to follow above steps to achieve this functionality. Could you please give it a try and let us know the feedback?

//Create instance of IEWSClient class by giving credentials
IEWSClient client = GetAsposeEWSClientTest3();

ExchangeMailboxInfo mailboxInfo = client.GetMailboxInfo();
ExchangeFolderInfo subfolderInfo = new ExchangeFolderInfo();
client.FolderExists(mailboxInfo.RootUri, "Drafts", out subfolderInfo);
ExchangeMessageInfoCollection msgInfoColl = client.ListMessages(subfolderInfo.Uri);

foreach (ExchangeMessageInfo msgInfo in msgInfoColl)
{
    MailMessage mail = client.FetchMessage(msgInfo.UniqueUri);
    mail.Body = "Modified:" + mail.Body;
    client.DeleteMessage(msgInfo.UniqueUri);
    client.AppendMessage(subfolderInfo.Uri, mail);
}