我想实现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); }
请指导。!!
答案 0 :(得分:0)
终于找到了一个好帖子,这有助于我解决我的问题..
http://msdn.microsoft.com/en-us/library/ms268994%28v=vs.80%29.aspx
感谢微软..;)