简体   繁体   English

如何显示指定附件的Outlook电子邮件附件预览

[英]How to show the Outlook email attachment preview for a specified attachment

I have a custom pane for emails in Outlook 2013, using VSTO. 我使用VSTO在Outlook 2013中为电子邮件提供了一个自定义窗格。 It lists the attachments in a ListView and allows conversion operations to be performed on the attachments: 它在ListView列出了附件,并允许对附件执行转换操作:

在此处输入图片说明

The user can normally press on an attachment to get a preview pane for the selected attachment. 用户通常可以按附件来获取所选附件的预览窗格。 I need to duplicate that preview action when the matching attachment is selected in my ListView. 我需要复制该预览行动时,在的ListView选择匹配的附件。 This will allow them to select one attachment, see the preview, then choose which type of document it is (ID doc, CV etc) without having to move back and forth between my custom panel and the usual list of attachments. 这将允许他们选择一个附件,查看预览,然后选择它是哪种文档类型(ID doc,CV等),而不必在我的自定义面板和常规附件列表之间来回移动。

I have Googled various terms, but this seems to too obscure to find. 我用Google搜索了各种术语,但这似乎太晦涩了。 I am hoping there is an Outlook 2013 VSTO expert out there that will know where to start with this. 我希望那里有一位Outlook 2013 VSTO专家,他们将从这里开始。 The Inspector.AttachmentSelection is a starting point, but that is read-only . Inspector.AttachmentSelection是一个起点,但是它是只读的

My C# selection change handler is shown below (all error checking removed to simplify it): 我的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???
}

Update: 更新:

As a fallback, I am able to go the other way, by catching the Inspector.AttachmentSelectionChange event as shown below and selecting items in my ListView , but I would prefer to be able to select the attachments from my ListView and that cause the AttachmentSelection to change: 作为后备,我可以通过捕获如下所示的Inspector.AttachmentSelectionChange事件并在ListView选择项目ListView另一种选择,但我希望能够从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;
                }
            }
        }
    }

Unfortunately there's nothing in the Outlook Object Model (or Redemption) that allows you to set the selected attachment. 不幸的是,Outlook对象模型(或赎回)中没有任何内容可让您设置选定的附件。

However, it may be possible to select it using some Win32API commands to set the focus on the attachment selector region. 但是,可能可以使用某些Win32API命令来选择它,以将焦点设置在附件选择器区域上。 If you use Spy++ you can see that it has a specific window handle (0007096E; AfxWndW). 如果使用Spy ++,则可以看到它具有特定的窗口句柄(0007096E; AfxWndW)。 When that window is activated, you could issue TAB keystroke commands to select an attachment. 激活该窗口后,您可以发出TAB击键命令来选择附件。 I'm not sure though how to activate a specific attachment; 我不确定如何激活特定附件。 TAB seems to be the only keyboard command in use for that window. TAB似乎是该窗口使用的唯一键盘命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM