Search code examples
c#rtfoutlook-redemption

Creating an rtf custom mail item


I'm using redemption to create a custom mail item and save it in the draft folder of my outlook. Currently the mailItem is saved in HTML format. I want to be able to save it in rtf Format. How can I do that ?

Here is the code I am using :

 Redemption.RDOSession session = new Redemption.RDOSession();
 session.MAPIOBJECT = olApp.Session.MAPIOBJECT;
 Redemption.RDOFolder rFolder = session.GetDefaultFolder(Redemption.rdoDefaultFolders.olFolderDrafts);
 Redemption.RDOMail rMsg = rFolder.Items.Add("ipm.note.mep");
 // modify some custom fields ...
 rMsg.BodyFormat = 3;
 rMsg.Save();

 Outlook.MailItem oMep = olApp.Session.GetItemFromID(rMsg.EntryID);
 oMep.BodyFormat = Outlook.OlBodyFormat.olFormatRichText;
 oMep.Display(false);

Changing the bodyFormat doesn't seem to work. I also tried the saveAs method with no success. I can change the format manually when the mailItem is open, but I want to do that automatically within my C# code.


Solution

  • Have you tried to set the RDOMail.RtfBody property?