Currently, the method write() in the class MAPIMessage return an UnsupportedOperationException. Is it possible to implement this method ? I try to save an Outlook message in attachment of an Outlook msg. Right now there is no way to do this. (without having an error when opening the message) Thanks.
To save out an attachment, your only current route is to grab the POIFS Directory that holds it, then use EntryUtils to save that into a new empty NPOIFS instance A write method would be good though, we'd love a patch with unit tests if you have time to write one!
The way you describe to save out an attachment works fine with all kinds of documents except outlook msg files. Msg files saved using this method will generate an error when I try to open it in Outlook. Outlook does not recognize the file saved. Maybe I should open a bug about that. I would like to provide you with a patch, unfortunately I have not enough knowledge about msg format.
There must be some additional changes needed / bits missing when a msg attachment gets written out What would be helpful is if you could create a simple small sample message, with an attachment inside it. Raise a new bug for the msg attachment saving, and upload there the outer message, the outlook-saved attachment, and the POI saved attachment. Bonus marks if you can also run some of the POI dev tools (eg org.apache.poi.poifs.dev.POIFSLister) to compare how the POI-saved and Outlook-saved attachments differ As for learning about the file format, the latest file format specs are available publicly at: https://msdn.microsoft.com/en-us/library/cc463912%28v=exchg.80%29.aspx?f=255&MSPPError=-2147217396
Okey, i will create a new bug with required files to solve the problem.