0
我想实现Outlook插件来访问邮件,日历,任务和联系人等Outlook项目的详细信息。点击邮件,联系人,日历和任务等Outlook项目的事件处理
我已经创建了示例插件并将许多自定义项添加到上下文菜单中。但我现在需要的是,如果我点击Outlook联系人,那么上下文菜单只有联系人相关的自定义项目(例如联系人姓名),所有其他要么禁用或从上下文菜单(例如事件名称)中删除。
示例代码如下:
public void PacktMenuItem_ItemContextMenuDisplay(Microsoft.Office.Core.CommandBar PacktCommandBar, Microsoft.Office.Interop.Outlook.Selection Selection) { // Commadbarpopup control to context menu item Office.CommandBarPopup callBarPopUp = (Office.CommandBarPopup)PacktCommandBar.Controls.Add(Office.MsoControlType.msoControlPopup, Type.Missing, "Custom Menu Item 1", PacktCommandBar.Controls.Count + 1, Type.Missing); // Set the tag value for the menu callBarPopUp.Tag = "PacktCustomMenuItem1"; // Caption for the context menu item callBarPopUp.Caption = "custom items"; // Set it to visible callBarPopUp.Visible = true; //item 1 Office.CommandBarButton callButton2 = (Office.CommandBarButton)callBarPopUp.Controls.Add(1, missing, missing, missing, true); callButton2.Caption = "Contact Name"; callButton2.Click += new Office._CommandBarButtonEvents_ClickEventHandler(Callxx2); //item 2 Office.CommandBarButton callButton3 = (Office.CommandBarButton)callBarPopUp.Controls.Add(1, missing, missing, missing, true); callButton3.Caption = "Event Name"; callButton3.Click += new Office._CommandBarButtonEvents_ClickEventHandler(Callxx3); }
请指导!!。