Làm việc với IBM Notes
Thông tin về IBM Notes
IBM Notes là phần khách và IBM Domino là phần máy chủ của một nền tảng phần mềm hợp tác kiểu client‑server. IBM Notes cung cấp các tính năng hợp tác như email, lịch, danh sách công việc, quản lý danh bạ, v.v. Tệp cơ sở dữ liệu được IBM Notes sử dụng được lưu dưới định dạng Notes Storage Facility (NSF).
Phát hiện tệp ở định dạng NSF
Đoạn mã mẫu dưới đây sẽ cho bạn thấy cách nhận dạng định dạng tệp 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.");
}
Đọc tin nhắn từ tệp lưu trữ NSF
Lưu ý, việc triển khai NSF khá hạn chế. Nói chung, có thể gặp một số vấn đề trong các trường hợp sau:
- Tệp này được tạo bởi Notes phiên bản 7 trở lên
- Được sử dụng nén LZ1
Aspose.Email cung cấp NotesStorageFacility class để đọc các tệp lưu trữ NSF. The NotesStorageFacility class cung cấp EnumerateMessages phương thức duyệt qua các tin nhắn trong tệp lưu trữ NSF. Đoạn mã mẫu sau đây trình bày việc sử dụng NotesStorageFacility class và EnumerateMessages phương thức để đọc tin nhắn từ tệp lưu trữ 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();
}