我正在为 Notes 8.5.2 开发一个 Lotus Notes 插件,它可以将附件从电子邮件保存到硬盘。但是,当我尝试从 Notes 文档中读取附件名称时,我总是得到相同的字符串,其中包含第一个附件名称和一些垃圾数据。
protected Vector<String> getAttachmentNames() throws NotesException,
IOException {
Vector<String> attachmentNames = new Vector<String>();
Item item = null;
Enumeration<?> itemsEnum = mailDoc.getItems().elements();
while (itemsEnum.hasMoreElements()) {
item = (Item) itemsEnum.nextElement();
if (item.getType() == Item.ATTACHMENT) {
attachmentNames.add(getAttachmentNameOf(item));
}
}
return attachmentNames;
}
protected String getAttachmentNameOf(Item item) throws NotesException,
IOException {
return getAttachmentName(item.getValueString());
}
getAttachmentName 仅进行一些字符串格式化以生成唯一的文件名。
最佳答案
需要注意的事情。 MIME 附件并不总是被识别为文档附件。因此,虽然您可以在 Notes 客户端中看到它,但您将无法以编程方式访问它。
以下技术说明详细介绍了它以及如何解决它。
http://www-01.ibm.com/support/docview.wss?rs=463&&uid=swg21219985
关于java - Lotus Notes 从文档中获取附件名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9083135/