Hi,
I have a pst file which contains an OLE attachment, and I cannot get the content. I have successfully extracted the content if the attachment type equals 1 (BY VALUE). But for the OLE attachments (attachmethod = 6), it does not work.
I am using the example code to get the attachment content:
int numberOfAttachments = email.getNumberOfAttachments();
for (int x = 0; x < numberOfAttachments; x++) {
PSTAttachment attach = email.getAttachment(x);
InputStream attachmentStream = attach.getFileInputStream();
....
}Once it goes to getFileInputStream() method, the isExternalValueReference is false, so it goes to the else branch. The PSTNodeInputStream does nothing about the attachment data.
public InputStream getFileInputStream() throws IOException, PSTException
{
PSTTableBCItem attachmentDataObject = items.get(0x3701);
if (attachmentDataObject.isExternalValueReference) {
PSTDescriptorItem descriptorItemNested = this.localDescriptorItems.get(attachmentDataObject.entryValueReference);
return new PSTNodeInputStream(this.pstFile, descriptorItemNested);
} else {
// internal value references are never encrypted
return new PSTNodeInputStream(this.pstFile, attachmentDataObject.data, false);
}
}Also, I have another PST file, which contains a normal attachment (attachmethod = 1). But when I try to getFileInputStream, it also goes to the else branch. It seems to be an attachment embedded in the email message body. For the two cases, I also tried the getEmbeddedPSTMessage to get the attached data, but the getEmbeddedPSTMessage returned null.
Is there anyway to get the attachment data out?
Thanks!