我有一个outlook插件代码,用于当用户右键单击任何电子邮件时,右键菜单中会显示插件选项。这适用于Outlook 2007和Outlook 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 :(得分:1)
已弃用命令栏 - 您必须使用IRibbonExtensibility自定义Outlook 2013 +的上下文菜单:
答案 1 :(得分:1)
Eric对命令栏的折旧是正确的。我认为这是一件好事。
我建议使用:
答案 2 :(得分:0)
您可以在Outlook 2007中使用旧方法(CommandBars)。但从Outlook 2010开始,Fluent UI用于自定义Outlook中的上下文菜单。您可以在以下文章中阅读更多相关信息:
Fluent UI(又名Ribbon UI)在以下文章中描述:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)
功能区设计器不为上下文菜单提供任何内容。您需要使用功能区XML标记来自定义上下文菜单。