下载某一封邮件中的指定附件 3个知识点: 1:需要通过NoteID来定位该邮件: Database dbMail = sNotes.getDatabase(sNotes.getServerName(), mailfile, false); Document doc = dbMail.getDocumentByID(noteid); 2:其次需要通过attachment name来定位该附件: EmbeddedObject eAttach = (EmbeddedObject)doc.getAttachment(attachmentFileName); 3:通过EmbeddedObject的extractFile方法下载附件。
[Domino]Java访问Domino邮件代码片断[4]
编写者 | 日期 | 关键词 |
郑昀@ultrapower | 2005-8-1 | Java Domino |
下载某一封邮件中的指定附件
3个知识点:
1:需要通过NoteID来定位该邮件:
Database dbMail = sNotes.getDatabase(sNotes.getServerName(),
mailfile, false);
Document doc = dbMail.getDocumentByID(noteid);
2:其次需要通过attachment name来定位该附件:
EmbeddedObject eAttach =
(EmbeddedObject)doc.getAttachment(attachmentFileName);
3:通过EmbeddedObject的extractFile方法下载附件。
代码片段: |
|
这其中的attachmentFileName参数是通过EmbeddedObject的getName方法拿到的:
// getName returns a String value containing the name
// used to reference an object that was embedded programmatically.
String strAttachmentObjectName =
eAttach.getName();
而不是通过getSource()拿到的。当一封邮件中同时存在多个重名附件时,getName()和getSource()就不一样了。
编写者 | 日期 | 关键词 |
郑昀@ultrapower | 2005-8-1 | Java Domino |