使用 IBM Notes
Contents
[
Hide
]
关于 IBM Notes
IBM Notes 是客户端,IBM Domino 是服务器的协作客户端-服务器软件平台。IBM Notes 提供电子邮件、日历、待办事项、联系人管理等协作功能。IBM Notes 使用的数据库文件以 Notes Storage Facility (NSF) 格式保存。
检测文件是否为 NSF 格式
下面的代码示例将展示如何识别 NSF 文件格式:
// Returns FileFormatType.Nsf for an NSF storage file
int formatType = FileFormatUtil.detectFileFormat("storage.nsf").getFileFormatType();
if (formatType == FileFormatType.Nsf) {
System.out.println("The file is in the NSF format.");
}
从 NSF 存储文件读取消息
注意,NSF 实现相当有限。一般情况下,可能在以下情况下遇到一些问题:
- 该文件由 Notes 7 版及以上创建
- 使用 LZ1 压缩
Aspose.Email 提供了 NotesStorageFacility class 用于读取 NSF 存储文件。该 NotesStorageFacility class 提供了 EnumerateMessages 遍历 NSF 存储文件中消息的方法。以下示例代码演示了该方法的使用 NotesStorageFacility class 和 EnumerateMessages 用于从 NSF 存储文件读取消息的方法。
// For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-Java
// The path to the resource directory.
String dataDir = "data/";
NotesStorageFacility nsf = new NotesStorageFacility(dataDir + "SampleNSF.nsf");
try {
for (MailMessage eml : nsf.enumerateMessages()) {
System.out.println(eml.getSubject());
}
} finally {
nsf.dispose();
}
请注意,目前仅实现了消息读取。由于缺少规范,文件夹读取尚不支持。