2015-11-20 85 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标记来自定义上下文菜单。

相关问题