Closed shilibi closed 7 months ago
Neither classes exposes data as an input stream. How did you get an inputstream from OutlookFileAttachment as you said?
I got the inputStream by this:
OutlookFileAttachment outlookFileAttachment = (OutlookFileAttachment)outlookAttachment; byte[] data = outlookFileAttachment.getData(); InputStream stream = new ByteArrayInputStream(data);
But I cannot got the inputStream by this:
if (outlookAttachment instanceof OutlookMsgAttachment) { msg = ((OutlookMsgAttachment) outlookAttachment).getOutlookMessage(); }
Does the inputStream can get by this way ?
if (outlookAttachment instanceof OutlookMsgAttachment) { msg = ((OutlookMsgAttachment) outlookAttachment).getOutlookMessage(); msg.getPropertyValue(SOME_CODE?); }
This problem has been bothering me for a long time = =、
Maybe I didn’t describe it clearly 😃, I wanna download the msg attachment in a msg file. I only can get the outlookMessage object for outlookMsgAttachment
I see! Well, I'm sorry to disappoint you, but that's not possible with this library. Under the hood, Apache POI is being used to decode the Outlook message structure, and when it encounters another Outlook message attachment, it is not available as data; it too is a parsed structure that we get back from Apache POI. There's nothing I can do about that, unfortunately.
Thank you very much for your reply. Does this mean that as long as you use the dependency of Apache POI, you cannot get inline attachments ? Do you know of other dependencies that can be used to obtain a nested Outlook message attachment ?
Not quite, the CID's are preserved, so inline (embedded) attachments are available. Just not Outlook messages in particular, as they are parsed internally right away by Apache POI.
As far as I know, there is nothing else in Java that is able to parse .msg files. Apache POI and the very few that are based on it - outlook-message-parser being the only real open source option I'm aware of - are the only ones capable of that.
Hi, I use outlook-message-parser, I can get inputstream of OutlookFileAttachment, but I can not get inputstream of OutlookMsgAttachment, how to get ?