How do I get attachments from a Lotus Notes email using VB.NET?

送分小仙女□ 提交于 2019-12-11 05:39:41

问题


I am trying to retrieve an attachment from a lotus notes email using the EmbeddedObjects array off of a NotesDocument object. In my test, I've set up an email with an attachment and am trying to process it. The HasEmbedded property of the NotesDocument object is returning true however the EmbeddedObjects array of the NotesDocument object is always nothing (null).

Any ideas what could be going on here? Why is the EmbeddedObjects array always nothing?


回答1:


I think in my last response I gave a somewhat incorrect answer. The EmbeddedObjects property of a NotesDocument only includes embedded OLE objects, and not file attachments. However, the NotesRichTextItem class has an embeddedObjects property which does included file attachments. So, if you know the name of the "field" which will hold your file attachments - and for email using the standard template, this will be "Body" - you can get that field as a rich text item and then get the file attachments from there. Here is a sample:

m_Doc = m_View.GetFirstDocument()
Do Until m_Doc is nothing
if (m_Doc.hasItem("body")) then
    m_rt = m_Doc.GetFirstItem("Body")
        if (m_rt.Type = RICHTEXT) then   ' RICHTEXT=1
            m_objects = m_rt.embeddedObjects
            ... ' same as earlier code to extract attachments
        end if
    end if
end if



回答2:


You can use evaluate("@AttachmentNames", doc) to get the list of attachments in a document. With the names (evaluate returns an array even if it is only one) you use doc.getAttachment to get a handle on it.



来源:https://stackoverflow.com/questions/1798867/how-do-i-get-attachments-from-a-lotus-notes-email-using-vb-net

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