2015-11-20 89 views
1

我有一個outlook插件代碼,當用戶右鍵單擊addin選項在右鍵菜單中顯示的任何電子郵件時。這發生在Outlook 2007和Outlook 2010中,但是當我在Outlook 2013中安裝插件時,該選項不會顯示在右鍵單擊菜單中。Addin Code在Outlook 2007和2010中工作,但不在Outlook 2013中

這裏是我的代碼:

Application.ItemContextMenuDisplay += ApplicationItemContextMenuDisplay; 

void ApplicationItemContextMenuDisplay(Office.CommandBar commandBar, Selection selection) 
     { 
      var cb = commandBar.Controls.Add(Office.MsoControlType.msoControlButton,missing, missing, missing, true) as Office.CommandBarButton; 
      if (cb == null) return; 
      cb.Visible = true; 
      cb.FaceId = 1675; 
      cb.Style = Office.MsoButtonStyle.msoButtonIconAndCaption;          
      cb.Click += new Office._CommandBarButtonEvents_ClickEventHandler(_oAddEmail_Click); 
      ConvergeCRMSetting settings = StateManager.current.CRMSettings; 

      if (selection.Count == 1 && selection[1] is Outlook.MailItem) 
      { 
       var item = (MailItem)selection[1];       
       string subject = item.Subject; 

       cb.Caption = "Add Email To ConvergeHub"; 
       cb.Enabled = true;           

      } 
      else 
      { 
       cb.Enabled = false; 
      } 
      bool bflag = false; 
      if (settings.Verified == true && settings.Active == true) 
      { 
       bflag = true; 
      } 
      switch (Convert.ToInt16(settings.Sd)) 
      { 
       case 0: 
        cb.Enabled = false; 
        break; 
       case 1: 
        cb.Enabled = bflag; 
        break; 
       case 2: 
        cb.Enabled = bflag; 
        break; 
       case 3: 
        //rbManual.Checked = true; 
        break; 
       default: 
        break; 
      } 

     } 

我必須做什麼,使插件選項,Outlook 2013中可見?有什麼建議麼 ?

+0

是否將Reference .dll更新爲最新版本?我們在工作中使用Excel Interop並且從Office 2010升級到2013年造成了一些嚴重問題。 –

+0

您的意思是Reference.dll或Outlook互操作參考? 在Outlook互操作性參考的情況下,我沒有升級它,因爲在那種情況下,我必須升級每個新版本進入市場。 – Mainak

回答

1

Eric是正確的命令欄的貶值自2013年辦事處和它有我認爲這是一件好事。

我會建議使用:

  1. 功能區可提供使用VSTO Visual Studio設計。它有一個友好的界面來創建絲帶而不是命令欄。附加事件的工作原理與Windows窗體或WPF設計器一樣。

    MSDN有用的閱讀方法here

  2. 的流利UI和IRibbonExtensibility結合上下文菜單等

    有用讀數上MSDN herehere

0

您可以在Outlook 2007中使用舊方法(CommandBars)。但從Outlook 2010開始,Fluent UI用於在Outlook中自定義上下文菜單。您可以在以下文章瞭解更多有關:

流暢的UI(又名絲帶UI)在下面的文章中描述:

區設計不提供上下文菜單什麼。您將需要使用功能區XML標記來自定義上下文菜單。

相關問題