0

メール、カレンダー、タスク、連絡先などのOutlookアイテムの詳細にアクセスするためのOutlookアドインを実装したいと思います。

サンプルアドインを作成し、コンテキストメニューに多くのカスタムアイテムを追加しました。しかし、今必要なのは、Outlookの連絡先をクリックすると、コンテキストメニューには連絡先に関連するカスタムアイテム(連絡先名など)のみが表示され、その他はすべて無効にするか、コンテキストメニューから削除されます(イベント名など)。

サンプルコードは次のとおりです。

public void PacktMenuItem_ItemContextMenuDisplay(Microsoft.Office.Core.CommandBar PacktCommandBar、Microsoft.Office.Interop.Outlook.Selection Selection)
        {{
            //Commadbarpopupコントロールからコンテキストメニュー項目へ
            Office.CommandBarPopup callBarPopUp =(Office.CommandBarPopup)PacktCommandBar.Controls.Add(Office.MsoControlType.msoControlPopup、Type.Missing、 "Custom Menu Item 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、missing、missing、missing、true);
            callButton2.Caption="連絡先名";
            callButton2.Click + = new Office._CommandBarButtonEvents_ClickEventHandler(Callxx2);

            //アイテム2
            Office.CommandBarButton callButton3 =(Office.CommandBarButton)callBarPopUp.Controls.Add(1、missing、missing、missing、true);
            callButton3.Caption="イベント名";
            callButton3.Click + = new Office._CommandBarButtonEvents_ClickEventHandler(Callxx3);
        }

案内してください!

4

1 に答える 1