This project has moved. For the latest updates, please go here.

Outlook.ExplorerEvents_10_SelectionChangeEventHandler ???

Sep 22, 2013 at 6: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.

Anyone?

thanks
Developer
Sep 23, 2013 at 6: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
                .ExplorerEvents_10_SelectionChangeEventHandler
                (CurrentExplorer_Event);
        }
It seems to be a VSTO delegate for Explorer.SelectionChange event. NetOffice aquivalents are
public event NetOffice.OutlookApi.Explorer_SelectionChangeEventHandler SelectionChangeEvent
and
public delegate void Explorer_SelectionChangeEventHandler()
Sep 23, 2013 at 11:36 AM
Edited Sep 23, 2013 at 1: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?

thanks
Coordinator
Sep 29, 2013 at 9: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)

*Sebastian