C# 为RibbonID Microsoft.Outlook.Explorer调用GetCustomUI()失败
我已经开发了一个Outlook 2010加载项,它可以在任何在Visual Studio(2010)中打开项目的计算机上完美运行,但是在所有其他计算机上都失败,并显示错误消息: “为RibbonID Microsoft.Outlook.Explorer调用GetCustomUI()失败” 这告诉我,调用IRibbonExtensibility接口方法失败了。这是一个运行时错误,但我不知道它是如何发生的或为什么发生的 “相同”外接程序以前使用Ribbon Designer类,现在已更改为使用Ribbon XML来支持外接程序添加的一些上下文菜单功能 该错误的影响是,尽管外接程序处于“活动”状态并加载到Outlook中,但不会显示其按钮等,因为该错误发生在显示任何XML功能区设计之前 在我发现的各种故障排除文章中,有许多关于可能出现错误的建议,其中之一是我编写的代码可能与Outlook 2007的代码相匹配,但不适用于2010年,但我不知道潜在的差异在哪里 以下是外接程序结构中不同位置的一些代码: 在MyOutlookAddIn.cs中:C# 为RibbonID Microsoft.Outlook.Explorer调用GetCustomUI()失败,c#,xml,vsto,outlook-addin,outlook-2010,C#,Xml,Vsto,Outlook Addin,Outlook 2010,我已经开发了一个Outlook 2010加载项,它可以在任何在Visual Studio(2010)中打开项目的计算机上完美运行,但是在所有其他计算机上都失败,并显示错误消息: “为RibbonID Microsoft.Outlook.Explorer调用GetCustomUI()失败” 这告诉我,调用IRibbonExtensibility接口方法失败了。这是一个运行时错误,但我不知道它是如何发生的或为什么发生的 “相同”外接程序以前使用Ribbon Designer类,现在已更改为使用Rib
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
{
return new Ribbon();
}
#region VSTO generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
然后返回“Microsoft.Outlook.Explorer”(“OutlookAddIn.RibbonDesignXML.Explorer.XML”)的我的XML:
很抱歉与您分享这么多代码,但是复制此问题似乎是一项徒劳的任务,而且我面临时间压力,因为外接程序由于扩展功能而完全破坏了外接程序,无法被我工作场所的各个实体使用
提前感谢所有能够洞察错误的人!尤其是为什么它能在涉及开发的机器上工作,而不是在其他机器上工作…确保RibbonXML作为嵌入式资源添加到您的项目中。我经常看到忽略了这个小细节,导致在开发人员机器上运行时没有问题,但在客户端用户机器上失败 如果已经正确地完成了(您的文本没有进入该细节),那么唯一的选择就是剥离。问题可能是RibbonXML定义的一部分,也可能是读取RibbonXML文件的一部分。只需从一个非常简单的XML和一个按钮定义开始,看看它是否适用于您的机器和客户端终端用户的机器。与GetCustomUI相同,将其限制为一行并检查结果。从那里开始扩展,直到找到故障源。我发现了问题。 声明:
Debug.WriteLine(ribbonId);
使整个应用程序在客户端机器上崩溃,而不是在开发机器上(在VisualStudio中打开了项目的机器)
有人知道这是怎么回事吗?Debug.WriteLines的全部目的不是只在调试期间起作用吗?它不应该在发布项目后对VSTO造成问题。。。这是一个荒谬的、很难发现的错误,因为它对我来说毫无意义
谢谢你的回复,@Maarten van Stam
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<ribbon>
<!-- Når en mail er valgt i kalender oversigten -->
<tabs>
<tab idMso="TabMail">
<group id="groupTabMail" label="Jira">
<button id="sendToJiraBtn" onAction="ExplorerSendToJiraButtonClicked" label="Send til Jira" getImage = "GetImage" size="large" />
<button id="jiraSettingsBtn" onAction="ExplorerSettingsButtonClicked" label="Indstillinger" getImage="GetSettingsImage" size="large" />
<button id="jiraSupportBtn" onAction="ExplorerSupportButtonClicked" label="Hjælp" getImage="GetSupportImage" size="large" />
</group>
</tab>
</tabs>
<!-- Når en aftale er valgt i kalender oversigten -->
<contextualTabs>
<tabSet idMso="TabSetAppointment">
<tab idMso="TabAppointment">
<group id="groupTabAppointment" label="Jira">
<button id="sendToJiraBtnAppointment" onAction="ExplorerSendToJiraButtonClicked" label="Send til Jira" getImage = "GetImage" size="large" />
<button id="jiraSettingsBtnAppointment" onAction="ExplorerSettingsButtonClicked" label="Indstillinger" getImage="GetSettingsImage" size="large" />
<button id="jiraSupportBtnAppointment" onAction="ExplorerSupportButtonClicked" label="Hjælp" getImage="GetSupportImage" size="large" />
</group>
</tab>
</tabSet>
<tabSet idMso="TabSetReccurringAppointment">
<tab idMso="TabRecurringAppointment">
<group id="groupTabRecurringAppointment" label="Jira">
<button id="sendToJiraBtnRecurringAppointment" onAction="ExplorerSendToJiraButtonClicked" label="Send til Jira" getImage = "GetImage" size="large" />
<button id="jiraSettingsBtnRecurringAppointment" onAction="ExplorerSettingsButtonClicked" label="Indstillinger" getImage="GetSettingsImage" size="large" />
<button id="jiraSupportBtnRecurringAppointment" onAction="ExplorerSupportButtonClicked" label="Hjælp" getImage="GetSupportImage" size="large" />
</group>
</tab>
</tabSet>
</contextualTabs>
</ribbon>
<contextMenus>
<contextMenu idMso="ContextMenuMailItem">
<menuSeparator id="MailSeparator"/>
<button id="SendToJiraMailItem"
getImage = "GetImage"
label="Send til Jira"
onAction="ExplorerSendToJiraButtonClicked"/>
<dynamicMenu id="DynamicMenuMail" label= "Send til Jira som..." getImage="GetImage" getContent="GetContent" />
</contextMenu>
<contextMenu idMso="ContextMenuMultipleItems">
<menuSeparator id="MultipleItemsSeparator"/>
<button id="SendToJiraMultipleItems"
getImage = "GetImage"
label="Send til Jira"
onAction="ExplorerSendToJiraButtonClicked"/>
<dynamicMenu id="DynamicMenuMultiple" label= "Send til Jira som..." getImage="GetImage" getContent="GetContent" />
</contextMenu>
<contextMenu idMso="ContextMenuCalendarItem">
<menuSeparator id="AppointmentSeparator"/>
<button id="SendToJiraCalendarItem"
getImage = "GetImage"
label="Send til Jira"
onAction="ExplorerSendToJiraButtonClicked"/>
<dynamicMenu id="DynamicMenuAppointment" label= "Send til Jira som..." getImage="GetImage" getContent="GetContent" />
</contextMenu>
</contextMenus>
</customUI>
Debug.WriteLine(ribbonId);