Reputation: 2593
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?
Upvotes: 1
Views: 2832
Reputation: 20374
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.
Upvotes: 0
Reputation: 8550
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
Upvotes: 1