我在 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;
}
}
}
}