Lotus notes get attachment names from document

落花浮王杯 提交于 2019-12-19 04:12:39

问题


I'm developing an Lotus Notes plug-in for Notes 8.5.2 that saves the attachments from an eMail to the Harddisk. But when I try to read the attachment names from a Notes document I always get the same string containing the first attachment name + some junk data.

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 only does some string formatting to generate a unique filename.


回答1:


Something to be aware of. MIME attachments are not always recognized as document attachments. So while you can see it in the notes client, you will not be able to programmatically access it.

The following tech note details it more and how to resolve it.

http://www-01.ibm.com/support/docview.wss?rs=463&&uid=swg21219985




回答2:


An "attachment" can not only be of the type ATTACHMENT, but also EMBEDDEDOBJECT, ...

Try to find all RichTextItems, get all the EmbeddedObjects from each of these items ( nrt.getEmbeddedObjects()) and then get the name of the embedded object (eo.getName()).



来源:https://stackoverflow.com/questions/9083135/lotus-notes-get-attachment-names-from-document

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!