In my Outlook VSTO addin, I'm trying to put a button that will appear when I right-click on a folder. In my autoload function, I have the following:
Outlook.Application myApp = new Outlook.ApplicationClass(); myApp.FolderContextMenuDisplay += new ApplicationEvents_11_FolderContextMenuDisplayEventHandler(myApp_FolderContextMenuDisplay);
then I have a handler for this ...
void myApp_FolderContextMenuDisplay(CommandBar commandBar, MAPIFolder Folder) { var contextButton = commandBar.Controls.Add(MsoControlType.msoControlButton, missing, missing, missing, true) as CommandBarButton; contextButton.Visible = true; contextButton.Caption = "some caption..."; contextButton.Click += new _CommandBarButtonEvents_ClickEventHandler(contextButton_Click); }
and finally a click handler ....
void contextButton_Click(CommandBarButton Ctrl, ref bool CancelDefault) {
My question is how to send this MAPIFolder Folder
from myApp_FolderContextMenuDisplay
to contextButton_Click
?
(If it can be done differently, I am also open to suggestions)
source share