如何使用VB.NET从Lotus Notes电子邮件中获取附件? [英] How do I get attachments from a Lotus Notes email using VB.NET?
问题描述
我正在尝试使用NotesDocument
对象的EmbeddedObjects
数组从Lotus Notes电子邮件中检索附件.在测试中,我设置了带有附件的电子邮件,并试图对其进行处理. NotesDocument
对象的HasEmbedded
属性返回true,但是NotesDocument
对象的EmbeddedObjects
数组始终为空(空).
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).
任何想法都会在这里发生什么?为什么EmbeddedObjects数组始终为空?
Any ideas what could be going on here? Why is the EmbeddedObjects array always nothing?
推荐答案
我认为在上次答复中,我给出了一个错误的答案. NotesDocument的EmbeddedObjects属性仅包含嵌入式OLE对象,而不包括文件附件.但是,NotesRichTextItem类具有一个EmbeddedObjects属性,该属性确实包含文件附件.因此,如果您知道用于保存文件附件的字段"的名称(对于使用标准模板的电子邮件,则为正文"),则可以将该字段作为富文本项获取,然后获取文件附件从那里.这是一个示例:
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
这篇关于如何使用VB.NET从Lotus Notes电子邮件中获取附件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!