We have written an Outlook Add-in that processes an email while it is being Sent. If you have ever worked with add-in express you may recognise the event adxOutlookEvents_ItemSend
Within the context of this event, the MailItem has not yet been sent. The idea being that, based on certain criteria, you can set e.Cancel to True and the email does not actually get Sent.
At the point where we are happy with the email and we would like to allow Sending to proceed, we can save the email as a .msg file using Outlook.MailItem.SaveAs
This is all well and good, but if you subsequently open the resulting .msg file, it’s presented to the user in “compose” mode. In other words, all the fields are editable. There is no “sent” date/time, there is no “from”.
None of the above has anything to do with Aspose, of course, but now we’re getting to the point where Aspose may be of help to us.
I am looking for a complete example of how to open such an “unsent” .msg file, and save it as a “sent” one.
I found examples such as this https://docs.aspose.com/display/emailnet/Working+with+MAPI+Properties#WorkingwithMAPIProperties-SettingMAPIProperties but I’m not making much progress with them. For example I see it setting a messageflag MSGFLAG_UNSENT but I see no flag like MSGFLAG_SENT. I tried MSGFLAG_ZERO but that still gives me a .msg file with a “null” SentOn date and no sender. I’m looking at outlook specific examples such as https://social.msdn.microsoft.com/Forums/office/en-US/741ea4f1-32cd-4ef5-800f-eda3a3212046/-c-set-a-mailitem-to-sent-true?forum=outlookdev but I can’t see the woods for the trees…
So I was hoping somebody in Aspose could cook me up a nice, self-contained example setting all the properties, values, etc. that I need to set in order for my Outlook to treat the .msg file as a Sent message with all the relevant data present.