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

Free Support Forum - aspose.com

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:
  1. Retrieve messages from drafts folder
  2. Modify it
  3. Delete old message
  4. 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
<o:p></o:p>

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);

}