outlookvstolotus-notesoutlook-addinmsg

VSTO (Outlook) is forcing MSG attachments to be of olEmbeddeditem type, but olByValue needed


I need to send email with .msg file attached to Lotus Notes (Domino) by using VSTO (from Outlook Add-In). When this file is received in Lotus Notes, the email body from msg file is appended to the end of the main mail.

From this problem I am assuming that the issue is in attachment type. I am trying to set the attachment type to by olByValue by adding attachment :

mail.Attachments.Add(msgFilePath, OlAttachmentType.olByValue, 0, displayName);

but whatever type I specify, it is still set to olEmbeddeditem.

Is there any way, how to force msg attachment to be olByValue?

Thank you for any suggestion or advise. Have a nice day.

Note: For reference I have created email in Lotus-Notes too with msg attached, sent to Outlook and than forwarded back to Lotus-Notes and msg is attached not appended to the end.


Solution

  • There is not much you can do in the Outlook Object Model - it always tries to be "helpful" and converts MSG files to embedded message attachments. If using Redemption is an option (I am its author), it will not change the type:

    SafeMailItem sItem = new SafeMailItem();
    sItem.Item = mail;
    sItem.Attachments.Add(msgFilePath);