Outlook Addin:在默认菜单的GetCustomUI中返回什么

时间:2014-04-03 13:41:22

标签: c# outlook vsto outlook-addin

我有一个我为Outlook 2013编写的插件,它正在按预期工作。但是,当用户右键单击联系人卡片时,会触发GetCustomUI方法(正如预期的那样)。但我不想显示联系人卡片的任何上下文菜单。我尝试返回string.empty和null但我收到以下错误:

the call to getcustomui() for ribbonid microsoft.mso.IMLayerUI Failed

我需要返回的任何想法只显示默认上下文菜单?

这就是我现在所拥有的:

   string IRibbonExtensibility.GetCustomUI(string ribbonId)
        {
            if (ribbonId == "Microsoft.Outlook.Explorer")
            {
                StringBuilder RibbonXmlBuilder = new StringBuilder();
                // Removed bussiness logic for question
                return RibbonXmlBuilder.ToString();
            }
            else
            {
                // What should i return?
                return null;
            }
        }

我也尝试过返回一个空的XML功能区,但这也不起作用:

return @"<?xml version=""1.0"" encoding=""UTF-8""?> <customUI xmlns=""http://schemas.microsoft.com/office/2009/07/customui""> <ribbon> </ribbon> 
</customUI>";

提前感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

尝试取消选中&#39; Business Contact Manager for Outlook&#39;在加载项列表中。