1

我正在阅读 .nsf Lotus Notes 文件并获取 NotesDocument。我想将此 NotesDocument 保存为包含所有图像、文本、标题和附件的 .eml 文件。可能吗?

4

1 回答 1

1

As far as I know, you will not be able to retrieve the whole document as a Mime Message. Nevertheless, you could start with the "NotesDocument.convertToMime"-method. Please forgive me, that my examples are in Java, C# and vb.net are not the languages of my choice ;)

So, let's begin with converting the document to a valid MIME-Message. The method grabs the RichTextItems and - as the name says - convert its content to MIME.

session.setConvertMIME(false);
doc.convertToMIME(Document.CVT_RT_TO_PLAINTEXT_AND_HTML); 

Now you can get the MIME-representation of the Rich-Text with:

MIMEEntity mime = doc.getMIMEEntity("body");
Stream stream = session.createStream();
stream.open(File.createTempFile("entity",".eml").getAbsolutePath();
if (mime!=null){
 mime.getEntityAsText(stream);
}

For the other "normal" fields, you could add their value as a X-Header to the main MIME-Part. Just iterate through the items of the NotesDocument and add the fieldnames with a leading "X-" as headers of the MIME-message.

Again, I'm sorry that I can't help you with your languages. I hope you will find the right way.

For the concept of working with MIME in IBM Notes, have a look at the IBM documentation.

于 2014-06-16T15:51:30.587 回答