Unable to read inline image attachment with name Picture (Device Independent Bitmap) using exchange web services 2007 RRS feed

  • Question

  • I am using Exchange Web Service 2007 to read the mails. I am able to read and save some of the inline image attachment. In such cases the name of the attachments is usually image001. But there are some inline image attachments with the name  Picture (Device Independent Bitmap) and the ews is unable to read / save such attachments. 

    One more thing I have observed is that whenever the email is send from a particular domain say the inline image attachment has the name image001 thus being readable. But if the same mail is send via a other domain say the inline image attachment has the name Picture (Device Independent Bitmap) thus it cannot be read.

    So I am confused if this is an issue with the EWS or some kind of setting on the exchange of the particular domain.

    Further I have found out that this happens only with outlook email send in rich text format. If the email is sent via outlook in html format everything work fines.

    Any help is highly appreciated.

    Tuesday, February 22, 2011 6:58 PM

All replies

  • Did you manage to solve your problem? I'm having this issue with rich text messages and I don't know how to fix it.
    Monday, October 17, 2011 2:34 PM
  • What you get back in a RTF message is the the data from the PR_ATTACH_DATA_OBJ property which is in OLE docfile or compound format. You can use IStorage interfaces to open the attachment and then extract the information from the particular steam within the OLE format there's a good tutorial on this

    Another workaround you can use if you just want the image file is to grab the MIME content and exchange should provide a converted version using something like

                PropertySet psPropset = new PropertySet(BasePropertySet.FirstClassProperties) { ItemSchema.MimeContent };
                EmailMessage em = EmailMessage.Bind(service, Item.Id, psPropset);
                File.WriteAllBytes(@"c:\testout.eml", em.MimeContent.Content); 

    You then should be able to parse the Images out of the MIME content


    Tuesday, October 18, 2011 4:30 AM
  • Thank you, you saved my week. As I really do hate pinvoke, I went down to the MIME content and used a parser to fetch the attachments. Here is a little explanation what I did. I really hope it helps someone.
    Thursday, October 20, 2011 11:45 AM