【发布时间】:2023-11-01 02:06:01
【问题描述】:
我有一个 VSTO Outlook 功能区(上下文菜单),它按预期工作:
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<contextMenus>
<contextMenu idMso="ContextMenuMailItem">
<button id="DoThis"
label="Label"
onAction="DoThis"
getVisible="GetVisible"/>
</contextMenu>
</customUI>
但是,如果我有一个 getLabel 属性,那么上下文菜单将不再显示。我想我一定是搞砸了,但没有迹象表明是什么;没有日志,没有例外,什么都没有。此外,我找不到任何地方记录每个回调的定义应该是什么。我只是尝试了明显的 getLabel 应该返回一个字符串,但它似乎不起作用。 getVisible 工作得很好(返回一个布尔值)。
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<contextMenus>
<contextMenu idMso="ContextMenuMailItem">
<button id="DoThis"
label="Label"
onAction="DoThis"
getVisible="GetVisible"
getLabel="GetLabelMoveToReviewFolderMultiple"/>
</contextMenu>
</customUI>
以及后面的代码(其他方法未展示):
[ComVisible(true)]
public class ContextMenu : Office.IRibbonExtensibility
{
public string GetLabelMoveToReviewFolderMultiple(Office.IRibbonControl control)
{
return "Custom Label";
}
}
【问题讨论】:
标签: vsto contextmenu outlook-addin ribbon