我正在尝试使用办公室插件中的 VB.net 将从 SQL 服务器检索到的二进制数据作为附件附加到电子邮件中。
如果我指定了文件路径和文件名,但不能使用二进制数据,我可以添加附件,下面是我的示例代码:
Dim ms as System.IO.MemoryStream
'binaryData is retrieved from SQL server
'binaryData is a docx file stored in SQL server
ms = New System.IO.MemoryStream(binaryData)
Dim att as New System.Net.Mail.Attachment(ms, System.Net.Mime.MediaTypeNames.Text.Plain)
mailItem.Attachments.Add(ms) 'mailItemm is Microsoft.Office.Interio.Outlook.MailItem
我收到错误
COMException was unhandled by user code
Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))
我在用:
Visual Studio 2010
.Net 4.0
Microsoft Outlook 2010
谢谢。