some images show as attachments in Outlook RRS feed

  • General discussion

  • I have an app that creates a mailItem in Word.  In it are three images, two .gif(s) and one .jpg.  The images are added as inline shapes.  While the jpg appears in the document (which is what I want), it also shows as an attachment.  The two gif images (part of a letterhead) also show in the document body, however not as attachments.  Why the difference?  I would prefer to not see any of the images showing as attachments.
    Monday, December 16, 2013 9:12 PM

All replies

  • I'm curious... is there any difference if the .jpg is designated/set as a .jpeg?

    Kind Regards, Rich ...

    Tuesday, December 17, 2013 2:25 AM
  • Hello jazcam,

    To prevent an attachment from showing in the inspector window in Outlook you need to set the PR_ATTACHMENT_HIDDEN MAPI property (0x7FFE000B) to true. The Attachment class provides the PropertyAccessor property which returns an instance of the PropertyAccessor class. It can be used for setting such properties. For example:

    string propTag = "";
    propertyAccessor.SetProperty(propTag, true);
    You can read more about this in the how to hide attachment in outlook forum forum thread. There also you can find a sample code.

    Tuesday, December 17, 2013 11:10 AM
  • Hi Rich,

    There is no difference between *.jpg and *.jpeg for Outlook.

    Tuesday, December 17, 2013 11:11 AM
  • There is a difference on how Outlook treats jpg versus jpeg on a Mac and that's why I asked the question. 

    Kind Regards, Rich ...

    Tuesday, December 17, 2013 12:05 PM
  • It looks as though this applies to versions 12 & up. 
    Tuesday, December 17, 2013 3:12 PM
  • Correct. PropertyAccessor was added in Outlook 2007.

    For earlier versions you'd need to use another API such as Extended MAPI (C++ or Delphi only recommended), or CDO 1.21 (limited by security and not recommended for managed code languages) or Redemption ( which is a COM wrapper on Extended MAPI.

    Ken Slovak MVP - Outlook

    Tuesday, December 17, 2013 3:27 PM
  • jazcam,

    You are on the right avenue.

    Tuesday, December 17, 2013 8:43 PM
  • I'll add this as a side.  I tried an experiment where I converted the .jpg to a .gif.  When I adjusted the layout of the image to square/right, it shows as an attachment.  But, without making any change to its layout, no attachment.  Then, I went back to its original format, the jpg, and the same thing -- the image shows in the body but not as an attachment.

    So, it has nothing to do with the file extension, and until you begin formatting its layout in the body, nothing happens.

    It also seems to make a difference with the size of the image.  I tried another experiment with a random image in my documents.  Most of the photo images are roughly wallet size, about 282x361 pixels (10kb), give or take.  I tried another image 504x303 (40.1kb) and whether I formatted the layout or not, it did not show as an attachment.  There is a correlation, I think, but I haven't found it yet.
    • Edited by jazcam Wednesday, December 18, 2013 3:13 PM
    Wednesday, December 18, 2013 2:37 PM