Lotus Notes 从文档中获取附件名称

2023-12-07

我正在为 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 附件并不总是被识别为文档附件。因此,虽然您可以在笔记客户端中看到它,但您将无法以编程方式访问它。

以下技术说明详细介绍了该问题以及如何解决该问题。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Lotus Notes 从文档中获取附件名称 的相关文章

随机推荐