I have a custom pane for emails in Outlook 2013, using VSTO. It lists the attachments in a ListView
and allows conversion operations to be performed on the attachments:
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. 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.
I have Googled various terms, but this seems to too obscure to find. I am hoping there is an Outlook 2013 VSTO expert out there that will know where to start with this. The Inspector.AttachmentSelection
is a starting point, but that is read-only.
My C# selection change handler is shown below (all error checking removed to simplify it):
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:
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;
}
}
}
}