Jimmy
Jimmy

Reputation: 5241

Debugging vsto ribbon callbacks

I have a VSTO Outlook ribbon (context menu), which works as expected:

<?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>

However, if I have a getLabel attribute, then the context menu does not show up at all anymore. I guess I must be screwing something up, but there is no indication what; no log, no exception, nothing. Furthermore, I can't find anywhere that documents what the definition of each callback should be. I just tried the obvious, that getLabel should return a string, but it does not seem to work. getVisible works just fine (returning a bool).

<?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>

and the code behind (other methods not shown):

[ComVisible(true)]
public class ContextMenu : Office.IRibbonExtensibility
{
    public string GetLabelMoveToReviewFolderMultiple(Office.IRibbonControl control)
    {
       return "Custom Label";
    }
}

Upvotes: 1

Views: 450

Answers (2)

Jimmy
Jimmy

Reputation: 5241

Well, while writing the question, I tried removing the label attribute for the context menu using getLabel, and that does resolve the issue; context menu works fine after that. I (initially) thought it might make sense to keep label as a default.

The documentation explains what is mutually exclusive.

Upvotes: 0

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66215

Do not use both label and getLabel. Also, enable addin errors in File | Options | Advanced | Developer to see all ribbon XML errors.

Upvotes: 3

Related Questions