使用 IBM Notes

关于 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 存储文件读取消息

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