【问题标题】:Getting Error Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))找不到错误成员。 (来自 HRESULT 的异常:0x80020003 (DISP_E_MEMBERNOTFOUND))
【发布时间】:2015-01-07 16:15:48
【问题描述】:

我正在开发 Outlook 2013 插件。

我的场景:

  1. 从 Outlook 邮件窗口获取所选邮件的邮件数据

  2. 创建新的电子邮件项目

  3. 使用所选电子邮件中的电子邮件数据更新新的电子邮件项目

  4. 发送电子邮件

如果我选择不带附件的电子邮件并进行操作,那么它工作正常。

但如果选定的电子邮件有附件,那么我会收到错误找不到成员。 (来自 HRESULT 的异常:0x80020003 (DISP_E_MEMBERNOTFOUND))

要获取选定的电子邮件数据,我使用以下代码

MailItem mailItem = null;
Attachments mtAttachments = null;

Explorer explorer = Globals.ThisAddIn.Application.ActiveExplorer();

if (explorer != null && explorer.Selection != null && explorer.Selection.Count > 0)
            {
                object item = explorer.Selection[1];
                if (item is MailItem)
                {
                    mailItem = item as MailItem;
                    subject = mailItem.Subject;
                    body = mailItem.HTMLBody;
                    mtAttachments = mailItem.Attachments;
                }
            }    

要发送带有附件的新电子邮件,我正在使用以下代码。

我正在低于错误。

谁能帮帮我?

【问题讨论】:

    标签: outlook outlook-addin outlook-2013


    【解决方案1】:

    Attachments.Add 只能接受带有文件名的字符串或其他 Outlook 项目(MailItem、XContactItem 等)。它不将 Attachments 对象的实例作为参数。

    如果要将附件从一封邮件复制到另一封邮件,请先将其另存为文件,然后将附件文件名作为参数传递。

    【讨论】:

      猜你喜欢
      • 2021-02-25
      • 1970-01-01
      • 2023-03-17
      • 2021-03-14
      • 1970-01-01
      • 1970-01-01
      • 2016-08-23
      • 1970-01-01
      • 2020-11-18
      相关资源
      最近更新 更多