Reputation: 597
I'm trying to extract the field BillingInformation from an Outlook .msg file using POI hsmf, but every time I get a ChunkNotFoundException. I've verified in Outlook that there is content in the field.
public class MessageReader {
private static final int SUBJECT_CHUNK = 0x0037;
private static final int BILLING_INFORMATION_CHUNK = 0x00008535;
public static void main(String[] argv) {
try {
MAPIMessage mapiMessage = new MAPIMessage("MessageWithBillingInformation.msg");
System.out.println(mapiMessage.getStringFromChunk(new StringChunk(SUBJECT_CHUNK, true)));
System.out.println(mapiMessage.getStringFromChunk(new StringChunk(BILLING_INFORMATION_CHUNK, true)));
} catch (IOException e) {
e.printStackTrace();
} catch (ChunkNotFoundException e) {
e.printStackTrace();
}
}
}
All the documentation I've found lists 0x00008535 as the right ID for Billing Information: http://msdn.microsoft.com/en-us/library/cc765867.aspx
Thank you
Upvotes: 0
Views: 1082
Reputation: 597
Using a chunkID of 0x800A works for reading the Billing Information field, so the code looks like this:
public class MessageReader {
private static final int SUBJECT_CHUNK = 0x0037;
private static final int BILLING_INFORMATION_CHUNK = 0x800A;
public static void main(String[] argv) {
try {
MAPIMessage mapiMessage = new MAPIMessage("MessageWithBillingInformation.msg");
System.out.println(mapiMessage.getStringFromChunk(new StringChunk(SUBJECT_CHUNK, true)));
System.out.println(mapiMessage.getStringFromChunk(new StringChunk(BILLING_INFORMATION_CHUNK, true)));
} catch (IOException e) {
e.printStackTrace();
} catch (ChunkNotFoundException e) {
e.printStackTrace();
}
}
}
Upvotes: 1