This project has moved and is read-only. For the latest updates, please go here.

Outlook.ExplorerEvents_10_SelectionChangeEventHandler ???

Sep 22, 2013 at 7:15 PM
Hi guys/gals, converting a an Outlook 2010 addin to NetOffice but can't for the life of me find the Outlook.ExplorerEvents_10_SelectionChangeEventHandler equivalent.


Sep 23, 2013 at 7:19 AM
I suppose you mention Outlook.ExplorerEvents_10_SelectionChangeEventHandler from the MSDN sample:
  private void ThisAddIn_Startup
            (object sender, System.EventArgs e)
            currentExplorer = this.Application.ActiveExplorer();
            currentExplorer.SelectionChange += new Outlook
It seems to be a VSTO delegate for Explorer.SelectionChange event. NetOffice aquivalents are
public event NetOffice.OutlookApi.Explorer_SelectionChangeEventHandler SelectionChangeEvent
public delegate void Explorer_SelectionChangeEventHandler()
Sep 23, 2013 at 12:36 PM
Edited Sep 23, 2013 at 2:10 PM
I can't seem to make that work, have you got an actual code example like the msdn one?

using Office = NetOffice.OfficeApi;
using NetOffice.Tools;
using NetOffice.OutlookApi.Tools;
using Outlook = NetOffice.OutlookApi;
using OutlookEnums = NetOffice.OutlookApi.Enums;

Outlook.Application _oL = new Outlook.Application();
Outlook.Explorer _oL_Explorer = _oL.ActiveExplorer(); // error cannot implicitly convert type NetOffice.OutlookApi._Explorer to NetOffice.OutlookApi.Explorer
_oL_Explorer.SelectionChangeEvent += new Outlook.Explorer_SelectionChangeEventHandler(Selection_Change_Event);

I can explicitly convert like this
Outlook.Explorer _oL_Explorer = ((Outlook.Explorer)_oL.ActiveExplorer());

Is that right?

Sep 29, 2013 at 10:52 PM
this is okay. Outlook.Explorer is the CoClass and Outlook._Explorer the implemented dispatch interface.
you need Outlook.Explorer in this case because only CoClasses can fire events. (COM rule)