'Moving Mail to Outlook Sent Folder. Mail is still editable

I am editing an email and send it to the recipient. But i also want to save the original mail in the sent folder. But if i move the mailobject to the folder the mail is still editable.

enter image description here

This is how i move the mail:

  private void CopyMailToSent(Outlook.MailItem originalMail)
  {
      var folder = originalMail.SaveSentMessageFolder;
      originalMail.Move(folder);          
  }

Can i set the mailobject to readonly or faking the send?



Solution 1:[1]

Firstly, Outlook Object Model would not let you set the MailItem.Sent property at all. On the MAPI level, the MSGFLAG_UNSENT bit in the PR_MESSAGE_FLAGS property can only be set before the message is saved for the very first time.

The only OOM workaround I am aware of is to create a post item (it is created in the sent state), set its message class to "IPM.Note", save it, release it, reopen by the entry id (it will be now MailItem in the sent state), reset the icon using PropertyAccessor, set some sender properties (OOM won't let you set all of them).

If using Redemption (I am its author) is an option, it will let you set the Sent property as well as the sender related properties, plus add recipients without having to resolve them.

Set MySession = CreateObject("Redemption.RDOSession")
MySession.MAPIOBJECT = Application.Session.MAPIOBJECT
Set folder = MySession.GetDefaultFolder(olFolderSentMail)
Set msg = folder.Items.Add("IPM.Note")
msg.Sent = True
msg.Recipients.AddEx "Joe The User", "[email protected]", "SMTP", olTo
msg.Sender = MySession.CurrentUser
msg.SentOnBehalfOf = MySession.CurrentUser
msg.subject = "Test sent message"
msg.Body = "test body"
msg.UnRead = false
msg.SentOn = Now
msg.ReceivedTime = Now
msg.Save

Solution 2:[2]

I couldn't solve the problem but i did workaround which works fine for me. I hope it's ok to post this here even it's not right the solution. If not, sorry i will delete it.

My workaround is saving the orignal mail as ".msg" file and then add it to the mail in the sent folder. Then it looks like this: enter image description here

This is the code:

private void SendMail(Outlook.Mailitem mail)
{
   mail.SaveAs(tempDirectory + @"originalMail.msg");
   var folder = mail.SaveSentMessageFolder;  
   ChangeMailSubject(mail);
   ChangeMailText(mail);
   mail.Send();
   folder.Items.ItemAdd += new Outlook.ItemsEvents_ItemAddEventHandler((sender) => AttachOriginalMail(sender);    
}

private void AttachOriginalMail(object sender)
{   
    var mail = (Outlook.MailItem) sender;
    mail.Attachments.Add(tempDirectory + @"originalMail.msg");
    mail.Save();
}   

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 ToKar