2

我在 Outlook 2013 中有一个使用 VSTO 的电子邮件自定义窗格。它列出 a 中的附件ListView并允许对附件执行转换操作:

在此处输入图像描述

用户通常可以按下附件来获得所选附件的预览窗格。在我的ListView中选择匹配的附件时,我需要复制该预览操作。这将允许他们选择一个附件,查看预览,然后选择它是哪种类型的文档(ID doc、CV 等),而无需在我的自定义面板和通常的附件列表之间来回移动。

我用谷歌搜索了各种术语,但这似乎太晦涩难懂了。我希望那里有 Outlook 2013 VSTO 专家知道从哪里开始。这Inspector.AttachmentSelection是一个起点,但那是只读的

我的 C# 选择更改处理程序如下所示(已删除所有错误检查以简化它):

private void listview_SelectedIndexChanged(object( sender, EventArgs e)
{
     ListView listView = sender as ListView;
     ListViewItem listViewItem = listView.SelectedItems[0];
     Attachment attachment = lvi.Tag as Attachment;
     Inspector inspector = Globals.ThisAddIn.Application.ActiveInspector();

     // How to preview the attachment in the inspector???
}

更新:

作为后备,我可以采取另一种方式,通过捕获Inspector.AttachmentSelectionChange如下所示的事件并在 my 中选择项目ListView,但我更希望能够从 my 中选择附件ListView并导致AttachmentSelection更改:

    void inspector_AttachmentSelectionChange()
    {
        this.attachmentListView.SelectedItems.Clear();
        foreach (Attachment selection in this.Inspector.AttachmentSelection)
        {
            foreach (ListViewItem item in this.attachmentListView.Items)
            {
                if (item.Tag as Attachment == selection)
                {
                    item.Selected = true;
                }
            }
        }
    }
4

1 回答 1

0

不幸的是,Outlook 对象模型(或赎回)中没有任何内容允许您设置选定的附件。

但是,可以使用某些 Win32API 命令将焦点设置在附件选择器区域上来选择它。如果您使用 Spy++,您可以看到它有一个特定的窗口句柄(0007096E;AfxWndW)。激活该窗口后,您可以发出 TAB 击键命令来选择附件。我不确定如何激活特定附件;TAB 似乎是该窗口使用的唯一键盘命令。

于 2014-10-22T14:52:04.340 回答