I have a piece of java code that recursively pulls out records from a pst file. Although, I can pull out emails that have an ole attachment and can access the binary value of the attachment. I have no idea how I can actually turn the binary value into something i can attach to a mime-message.
OLE attachments (IStorage) contain data in a format understood only by the COM server that created the object (such as Word or Excel). Outlook Object Model does not allow to save attachments like that. I also don't think you can access the IStorage object through IAttach::OpenProperty(PR_ATTACH_DATA_OBJ, ...) in Java.
You can see the attachment data in OutlookSpy - select the message, click IMessage button, go to the GetAttachmentTable tab, double click on the attachment, select the PR_ATTACH_DATA_OBJ property, right click, IMAPIProp::OpenProperty, select IStorage interface - you will see the IStorage object with its streams.
You can try to use Redemption - its RDOAttachment.SaveAsFile method extracts the data for the bitmap (BMP), Windows Meta File (WMF/EMF), Excel, Word, PowerPoint, WordPad, and Adobe PDF file formats.
-
thank you - I used apache POI to explore the data attached. What is strange is that if the OLE attachment has a CONTENT entry then I can extract the bits in the entry and attach it to the html-email and shows up as a pic. If it doesn't have CONTENT then I can't do anything with it. Are there no guidelines for adding OLE attachments to HTML emails? – hba May 6 '14 at 15:12
-
I don't think there are any guidelines - one way or another, you need to extract the actual data from IStorage. How you do that depends on the particular object. – Dmitry Streblechenko May 6 '14 at 16:50