none
Outlook treats MSG as Plain Text while it's properties shows otherwise RRS feed

  • Question

  • I've developed an Outlook Add-in which has the ability to save e-mails to our software.

    The e-mails are stored on a networkdrive. But the problem is, when re-opening the MSG in Outlook, Outlook treats the MSG as Plain-Text while it's underlaying properties show that it's HTML.

    PR_RTF_COMPRESSED = {\rtf1\ansi\ansicpg1252\fromhtml1\}
    The code below saves the selected e-mail with different "SaveAsType"

    mail.SaveAs(Path.GetTempPath() + @"\DMS\" + "TEST Outlook.msg");
    mail.SaveAs(Path.GetTempPath() + @"\DMS\" + "TEST OlSaveAsType.olMSG.msg", OlSaveAsType.olMSG);
    mail.SaveAs(Path.GetTempPath() + @"\DMS\" + "TEST OlSaveAsType.olMSGUnicode.msg", OlSaveAsType.olMSGUnicode);

    RDOSession session = new RDOSession { MAPIOBJECT = AddinModule.CurrentInstance.OutlookApp.Session.MAPIOBJECT };

    RDOMail rdomail = session.GetMessageFromID(EntryID);
    rdomail.SaveAs(Path.GetTempPath() + @"\DMS\" + "TEST Redemption.msg");
    rdomail.SaveAs(Path.GetTempPath() + @"\DMS\" + "TEST rdoSaveAsType.olMSG.msg", rdoSaveAsType.olMSG);
    rdomail.SaveAs(Path.GetTempPath() + @"\DMS\" + "TEST rdoSaveAsType.olMSGUnicode.msg", rdoSaveAsType.olMSGUnicode);

    Every saved MSG should have HTML, but when we open it in Outlook it's shown as PlainText.

    Best regards,

    Jouke van Rossum

    Tuesday, January 30, 2018 8:01 AM

All replies

  • Hello Jouke van Rossum,

    What's the version of your Outlook? I tried to use your simply code to save a msg to a network drive with Outlook 2016, it keep html format while re-opening it. I also tried to save as the file manually, there is no difference.

    If you save the file to a local hard drive, will this issue occur?

    If you save the file manually instead of using code, will this issue occur?

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, January 31, 2018 6:01 AM
  • Hello Terry,

    Thank you for your response!

    It does not matter what version of outlook is being used. It happens in Outlook 2010, 2013 and 2016.

    Yes, as you can see the code places the MSG's in the Temp folder of the current user in the folder "DMS".

    No, if I drag and drop to the desktop or use the Save As function in Outlook and this error does not occur.

    Weird thing is that as mentioned above, the property of the e-mail says it's HTML....

    Best regards,

    Jouke

    Wednesday, January 31, 2018 7:59 AM