Nitin I am posting the code snippet here

POIFSFileSystem newDoc = new POIFSFileSystem();
POIFSFileSystem poifs = new POIFSFileSystem(new FileInputStream(new
File("fileName")));
                                
for(Entry entry : poifs.getRoot()){
        
    if(! entry.getName().startsWith(AttachmentChunks.PREFIX)) {
         EntryUtils.copyNodeRecursively(entry, newDoc.getRoot());
      }
}
                
                
File fToWrite = new File("C:/CR0040POC/detachedMail/"+msgFile);
OutputStream out = new FileOutputStream(fToWrite);
newDoc.writeFilesystem(out);
out.close();

--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/Removing-attachments-from-MSG-file-tp5710382p5710407.html
Sent from the POI - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to