poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lucaro <sachint...@gmail.com>
Subject Re: Removing attachments from .MSG file
Date Mon, 09 Jul 2012 05:12:42 GMT
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message