Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
In my outlook 2007 AddIn, Menu is appearing.... But, Context Menu Click event is not firing...
Please point out what's the issue with my code ....

C#
private void ThisAddIn_Startup(object sender, System.EventArgs e)
      {

          var inspectors = this.Application.Inspectors;

          Application.ItemContextMenuDisplay += new Outlook.ApplicationEvents_11_ItemContextMenuDisplayEventHandler(myApp_FolderContextMenuDisplay);

      }

      private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
      {
      }


      void myApp_FolderContextMenuDisplay(Office.CommandBar commandBar, Outlook.Selection Folder)
      {

          if (Folder[1] is Outlook.ContactItem)
          {

              var contextButton = commandBar.Controls.Add(Office.MsoControlType.msoControlButton, missing, missing, 1, true) as Office.CommandBarButton;
              contextButton.Visible = true;
              contextButton.Caption = "Call Using FPHone";
              contextButton.Height = 30;
              contextButton.Parameter = "Call";
              contextButton.Click += new Office._CommandBarButtonEvents_ClickEventHandler(contextButton_Click);
           }
}

void contextButton_Click(Office.CommandBarButton Ctrl, ref bool CancelDefault)
        {
//This event is not firing
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900