0

我想实现 Outlook 插件来访问 Outlook 项目的详细信息,如邮件、日历、任务和联系人。

我创建了示例插件并将许多自定义项添加到上下文菜单中。但我现在需要的是,如果我单击 Outlook 联系人,则上下文菜单只有与联系人相关的自定义项目(例如联系人姓名),所有其他的要么禁用或从上下文菜单中删除(例如事件名称)。

示例代码如下:

公共无效 PacktMenuItem_ItemContextMenuDisplay(Microsoft.Office.Core.CommandBar PacktCommandBar,Microsoft.Office.Interop.Outlook.Selection 选择)
        {
            // Commadbarpopup 控件到上下文菜单项
            Office.CommandBarPopup callBarPopUp = (Office.CommandBarPopup)PacktCommandBar.Controls.Add(Office.MsoControlType.msoControlPopup, Type.Missing, "自定义菜单项 1", PacktCommandBar.Controls.Count + 1, Type.Missing);
            // 设置菜单的标签值
            callBarPopUp.Tag = "PacktCustomMenuItem1";
            // 上下文菜单项的标题
            callBarPopUp.Caption = "自定义项目";
            // 设置为可见
            callBarPopUp.Visible = true;

            //项目1
            Office.CommandBarButton callButton2 = (Office.CommandBarButton)callBarPopUp.Controls.Add(1, 缺失, 缺失, 缺失, true);
            callButton2.Caption = "联系人姓名";
            callButton2.Click += new Office._CommandBarButtonEvents_ClickEventHandler(Callxx2);

            //项目2
            Office.CommandBarButton callButton3 = (Office.CommandBarButton)callBarPopUp.Controls.Add(1, 缺失, 缺失, 缺失, true);
            callButton3.Caption = "事件名称";
            callButton3.Click += new Office._CommandBarButtonEvents_ClickEventHandler(Callxx3);
        }

请指导。!!

4

1 回答 1

1

终于找到了一篇好帖子,帮助我解决了我的查询..

http://msdn.microsoft.com/en-us/library/ms268994%28v=vs.80%29.aspx

感谢微软..;)

于 2013-03-06T05:46:22.827 回答