gpt4 book ai didi

java - 如何使用 Apache POI HSMF 读取公共(public)属性

转载 作者:行者123 更新时间:2023-12-01 15:32:26 24 4
gpt4 key购买 nike

我尝试使用 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

谢谢

最佳答案

使用 chunkID 0x800A 可以读取账单信息字段,因此代码如下所示:

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();
}
}

}

关于java - 如何使用 Apache POI HSMF 读取公共(public)属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9415981/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com