Outlook attachment contains some unknown images "image00001" if I add "Outlook Item" type of attachment or share document via link. RRS feed

  • Question

  • My goal is to check all attachments from email and show a message with a recommendation to upload file to cloud and share file by link if even one of them located on PC.

    Currently, if I add some file from PC, in this case 

    item.Attachments.Count = 1; att.Type = Outlook.OlAttachmentType.olByValue;

     and I can check it like this

    public bool IsAttachmentLocal(Outlook item)


      foreach (Outlook.Attachment att in item.Attachments)


              if (att.Type == Outlook.OlAttachmentType.olByValue && null == att.PathName)


    return true;




    But if I add some "Outlook Item" (message) or some file via cloud location, then item.Attachments.Cout = 5.
    The first element of this array is file with type olEmbeddeditem or 7(in case with cloud location file). 
    The next four elements some unknown images with name "image00001" which are have 

    att.Type = Outlook.OlAttachmentType.olByValue;

    and passed my checking.

    I have a suspicion, that it can be thumbnail image

    How Can I check file location in his case? Can I pass somehow these images?

    Thursday, August 15, 2019 8:08 AM

All replies

  • 7 is ATTACH_BY_WEB_REF. The attachment itself must be a *.url file. Its format is something like the following.



    Dmitry Streblechenko (MVP)
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Thursday, August 15, 2019 1:38 PM
  • Hello Anna,

    Some attached images can be hidden from the view in Outlook and be used in the message bodies to prevent any internet connection for downloading external images. To detect such images you can get the image CID value and try to find a corresponding value used in the img tags of the message body, for example, here is the code for adding such images:

    Attachment attachment = newMail.Attachments.Add(
        , OlAttachmentType.olEmbeddeditem
        , null
        , "Some image display name"
       string imageCid = "image001.jpg@123";
        , imageCid
       newMail.HTMLBody = String.Format(
         "<body><img src=\"cid:{0}\"></body>"
        , imageCid

    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Sunday, August 18, 2019 9:32 AM