none
embedded images not visible (but after reopen) RRS feed

  • Question

  • Hallo, I need help for embed images in Outlook.Mailitem.

    This is my current code:

    Outlook.Inspector insp = m_Mail.GetInspector;
    if (insp.IsWordMail())
    {
        Word.Document doc = (Word.Document)insp.WordEditor;
        ...
        Outlook.Attachment a = m_Mail.Attachments.Add(imgpath, Microsoft.Office.Interop.Outlook.OlAttachmentType.olEmbeddeditem, null, "");
        a.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", "imagename@123");
        ...

    The HTML part of the message body contains the following line:

    <img width=155 height=19 alt="image1" src="cid:imagename@123">

    But the image is not visible. Only a frame with the message "The linked image cannot be displayed...".

    But if I save the message as draft and reopen it the image is visible.

    What's the reason?

    Andreas


    • Edited by andreas_0815 Wednesday, January 15, 2014 2:51 PM
    Wednesday, January 15, 2014 2:50 PM

Answers

  • How do you handle the inline response feature of Outlook?

    Note, Outlook 2013 introduces a new property for the Explorer class – ActiveInlineResponse. It allows getting an item which is listed in the Outlook 2013 reading pane in case the inline response is active. To leverage the extended capabilities from the Word Object Model, you can use the ActiveInlineResponseWordEditor property, which returns a Word Document of the active inline response.

    • Marked as answer by andreas_0815 Thursday, January 16, 2014 12:48 PM
    Wednesday, January 15, 2014 6:32 PM

All replies

  • Hello Andreas,

    It is by design. Outlook doesn't reflect changes for inspectors made using the Outlook Object Model on the fly.

    Also I have noticed that you don't release underlying COM objects instantly:

    mail.Attachments.Add(imgpath, Microsoft.Office.Interop.Outlook.OlAttachmentType.olEmbeddeditem, null, "");
    a.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", "imagename@123");

    The Attachments property of the MailItem class returns an instance of the corresponding class which should be released after. Moreover, the Add method of the Attachments class returns an instance of the Attachment class.

    Also the PropertyAccessor class of the Attachment class returns an instance of the PropertyAccessor class which is left not released.

    Wednesday, January 15, 2014 3:16 PM
  • Hallo,

    I've implemented the release functions for all objects, now. But this was not the problem, because the text was visible and the images not. I've tested to write the document content first and attache the images afterwards. Now it's working! Any explanation?

    The second question:

    I also want to write content to the inline response (Outlook.Explorer....). But in this case also the text is not visible. But after save as draft and reopen everything is visible. Is there an solution to update/refresh/reload the inline response?

    Andreas

    Wednesday, January 15, 2014 4:57 PM
  • How do you handle the inline response feature of Outlook?

    Note, Outlook 2013 introduces a new property for the Explorer class – ActiveInlineResponse. It allows getting an item which is listed in the Outlook 2013 reading pane in case the inline response is active. To leverage the extended capabilities from the Word Object Model, you can use the ActiveInlineResponseWordEditor property, which returns a Word Document of the active inline response.

    • Marked as answer by andreas_0815 Thursday, January 16, 2014 12:48 PM
    Wednesday, January 15, 2014 6:32 PM
  • Great,

    I've use the "normal" WordEditor of the inspector. But with the ActiveInlineResponseWordEditor it's working perfect.

    Thx, Andreas

    Thursday, January 16, 2014 12:48 PM