views:

494

answers:

2

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). Please see the screenshot below.

alt text

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

A: 

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
Ed Schembor
Thanks for all your help! You're a life-saver!
Lee Warner
A: 

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.

stwissel