For some reason, in my application, my FolderSwitch works with the main explorer that the application opens, but the NewExplorer event never fires, so obviously the FolderSwitch event will not fire in the new explorer.
I can not understand why the event is not triggered.
private List<_Outlook.Explorer> ListOfExplorerWindows = new List<_Outlook.Explorer> { }; private _Outlook.Application Application; public void OnConnection(object Application, Extensibility.ext_ConnectMode ConnectMode, object AddInInst, ref Array custom) { this.Application = (_Outlook.Application)Application; } public void OnStartupComplete(ref Array custom) { _Outlook.Explorer Explorer = this.Application.ActiveExplorer(); Explorer.FolderSwitch += new _Outlook.ExplorerEvents_10_FolderSwitchEventHandler(Explorer_FolderSwitch); ListOfExplorerWindows.Add(Explorer); this.Application.Explorers.NewExplorer += new _Outlook.ExplorersEvents_NewExplorerEventHandler(Explorers_NewExplorer); } private void Explorers_NewExplorer(_Outlook.Explorer Explorer) { Explorer.FolderSwitch += new _Outlook.ExplorerEvents_10_FolderSwitchEventHandler(Explorer_FolderSwitch); ListOfExplorerWindows.Add(Explorer); }
source share