You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by lucaro <sa...@gmail.com> on 2012/07/10 08:31:42 UTC
Read .msg file inside other .msg file
can anyone help me, How to read .msg file inside another .msg file.
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Read-msg-file-inside-other-msg-file-tp5710411.html
Sent from the POI - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: Read .msg file inside other .msg file
Posted by lucaro <sa...@gmail.com>.
One interesting part of it is
file size is changing when i tried to open the saved file.
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Read-msg-file-inside-other-msg-file-tp5710411p5710439.html
Sent from the POI - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: Read .msg file inside other .msg file
Posted by Nick Burch <ni...@alfresco.com>.
On 11/07/12 09:03, lucaro wrote:
> Is there any other way to write embedded message into the file?
The problem looks to be that outlook is expecting more than just that
bit of the file when the message goes to live on its own. You'll need to
track down what those extra bits are, then manually add them in after
you've copied what is there.
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: Read .msg file inside other .msg file
Posted by lucaro <sa...@gmail.com>.
Is there any other way to write embedded message into the file?
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Read-msg-file-inside-other-msg-file-tp5710411p5710437.html
Sent from the POI - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: Read .msg file inside other .msg file
Posted by Nick Burch <ni...@alfresco.com>.
On Tue, 10 Jul 2012, lucaro wrote:
> It is giving me
> http://apache-poi.1045710.n5.nabble.com/file/n5710420/error.bmp
Hmm, how odd. I guess there must be some other state somewhere that gets
implicitly added my outlook :(
You could try asking on some outlook forums, and see if anyone knows of
any validator tools that would help you work out what's wrong
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: Read .msg file inside other .msg file
Posted by lucaro <sa...@gmail.com>.
> POIFSFileSystem newDoc = new POIFSFileSystem();
> EntryUtils.copyNodes(attachment.attachmentDirectory.getDirectory(),
> newDoc.getRoot());
> File fileToWrite = new File("C:/CR0040POC/detachedMail/" +
> attachMsg.getConversationTopic()+".msg");
> OutputStream outStream = new FileOutputStream(fileToWrite);
> newDoc.writeFilesystem(outStream);
> //In this way it is giving me error in opening file.
What sort of error? This looks like it ought to work
It is giving me
http://apache-poi.1045710.n5.nabble.com/file/n5710420/error.bmp
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Read-msg-file-inside-other-msg-file-tp5710411p5710420.html
Sent from the POI - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: Read .msg file inside other .msg file
Posted by Nick Burch <ni...@alfresco.com>.
On 10/07/12 11:54, lucaro wrote:
> In two ways I tried, but Problem still persist.
What problem?
> POIFSFileSystem newDoc = new POIFSFileSystem();
> EntryUtils.copyNodes(attachment.attachmentDirectory.getDirectory(),
> newDoc.getRoot());
> File fileToWrite = new File("C:/CR0040POC/detachedMail/" +
> attachMsg.getConversationTopic()+".msg");
> OutputStream outStream = new FileOutputStream(fileToWrite);
> newDoc.writeFilesystem(outStream);
> //In this way it is giving me error in opening file.
What sort of error? This looks like it ought to work
> POIFSFileSystem newDoc =
> attachment.attachmentDirectory.getDirectory().getFileSystem();
> File fileToWrite = new File("C:/CR0040POC/detachedMail/" +
> attachMsg.getConversationTopic()+".msg");
> OutputStream outStream = new FileOutputStream(fileToWrite);
> newDoc.writeFilesystem(outStream);
This won't work. You need to do a copy. This just writes the same thing
out again
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: Read .msg file inside other .msg file
Posted by lucaro <sa...@gmail.com>.
In two ways I tried, but Problem still persist.
POIFSFileSystem newDoc = new POIFSFileSystem();
EntryUtils.copyNodes(attachment.attachmentDirectory.getDirectory(),
newDoc.getRoot());
File fileToWrite = new File("C:/CR0040POC/detachedMail/" +
attachMsg.getConversationTopic()+".msg");
OutputStream outStream = new FileOutputStream(fileToWrite);
newDoc.writeFilesystem(outStream);
//In this way it is giving me error in opening file.
POIFSFileSystem newDoc =
attachment.attachmentDirectory.getDirectory().getFileSystem();
File fileToWrite = new File("C:/CR0040POC/detachedMail/" +
attachMsg.getConversationTopic()+".msg");
OutputStream outStream = new FileOutputStream(fileToWrite);
newDoc.writeFilesystem(outStream);
//In this way it is writting Complete msg (i.e. msg inside another msg)
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Read-msg-file-inside-other-msg-file-tp5710411p5710418.html
Sent from the POI - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: Read .msg file inside other .msg file
Posted by Nick Burch <ni...@alfresco.com>.
On Tue, 10 Jul 2012, lucaro wrote:
> Now, I am able to get Embeded msg
> But want to dump this in a new file
>
> I tried
> mapIMessage.write(outputstream);
>
> its giving me error:
> java.lang.UnsupportedOperationException: Writing isn't yet supported for
> HSMF, sorry
Grab the POIFS directory from the attachment directory, then use the utils
helper to copy that to a new POIFSFileSystem instance
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: Read .msg file inside other .msg file
Posted by lucaro <sa...@gmail.com>.
Now, I am able to get Embeded msg
But want to dump this in a new file
I tried
mapIMessage.write(outputstream);
its giving me error:
java.lang.UnsupportedOperationException: Writing isn't yet supported for
HSMF, sorry
How can I do this?
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Read-msg-file-inside-other-msg-file-tp5710411p5710414.html
Sent from the POI - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: Read .msg file inside other .msg file
Posted by Nick Burch <ni...@alfresco.com>.
On 10/07/12 07:31, lucaro wrote:
> can anyone help me, How to read .msg file inside another .msg file.
They're stored as a special kind of attachment
First up, get the attachments
http://poi.apache.org/apidocs/org/apache/poi/hsmf/MAPIMessage.html#getAttachmentFiles()
Loop over the attachment chunks, looking for one with a directory that
isn't null:
http://poi.apache.org/apidocs/org/apache/poi/hsmf/datatypes/AttachmentChunks.html#attachmentDirectory
On the directory chunk, get the embedded message, and process just as
you would a regular message
http://poi.apache.org/apidocs/org/apache/poi/hsmf/datatypes/DirectoryChunk.html#getAsEmbededMessage()
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org