Hi,
I'm trying to read the message (.msg file) header information stored in the repository but facing difficulties. I used Apache POI library to achieve it.
The code which I used to read messge Header is as below.
try {
String query = "select * from dm_docuemnt where a_content_type = 'msg' and mdmo_message_aspect.attachment_count > 0 ";
IDfCollection docs = null;
IDfQuery iDfQuery = null;
iDfQuery = new DfQuery(query);
docs = iDfQuery.execute(mySession, DfQuery.DF_QUERY);
if (null != docs){
while(docs.next()){
IDfDocument doc = (IDfDocument) mySession.getObject(new DfId(docs.getString("r_object_id")));
MAPIMessage mapiMsg = new MAPIMessage(doc.getContent());
System.out.println("Header Information >>>>"+mapiMsg.getHeaders());
}
}
} catch (Exception e) {
}
I'm getting exception like
org.apache.poi.hsmf.exceptions.ChunkNotFoundException: Chunk not found
at org.apache.poi.hsmf.MAPIMessage.getStringFromChunk(MAPIMessage.java:168)
at org.apache.poi.hsmf.MAPIMessage.getHeaders(MAPIMessage.java:483)
at com.tata.cms.tbo.DocumentTBO.main(DocumentTBO.java:110)
I also tried to convert ByteArrayInputStream and print it on console and it is converting.
Please help me is there any other way available way to retrieve header info of a .msg file available in repository.
Thank You.