我正在尝试使用POI hsmf从Outlook .msg文件中提取字段BillingInformation,但每次我收到ChunkNotFoundException。我在Outlook中验证了该领域的内容。
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();
}
}
}
我发现的所有文档都列出了0x00008535作为结算信息的正确ID: http://msdn.microsoft.com/en-us/library/cc765867.aspx
谢谢
答案 0 :(得分:1)
使用0x800A的chunkID可以读取“结算信息”字段,因此代码如下所示:
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();
}
}
}