Search code examples
outlookvstooutlook-addinoffice-addinsribbonx

Outlook refuses to display customized ribbon


My situation is similar to this one, but neither of the answers there worked for me.

In a brand-new project with no code, I have a very simple ribbon button:

enter image description here

...but Outlook (latest version, M365) will no longer display it. I say "no longer" because at first it did. I then removed it manually by Customizing the Ribbon and removing the custom group from the right-hand list:

enter image description here

Apparently, however, I should have removed it via the File\Options\Add-ins dialog, as it now won't display at all, no matter what I do. Oddly, the stock Add-ins\Get Add-ins combo flickers ever so slightly when I F5 run the project with Visual Studio (2022).

The more common solutions don't work. Web searches turn up answers to every problem but this one. ChatGPT is AWOL, presumably out trying to catch Rosie the Robot.

How do I get my button (and group) to show up again?

--EDIT--

I have since discovered that the ribbon does at least attempt to load when I start a new email message (but only the first time after I restart Outlook).

After turning on Show VSTO Add-in user interface errors in the Advanced options, I get this:

enter image description here

I tried renaming the tab in the designer to TabMail, but that didn't bring any improvement.

Here're the Properties for the RibbonTab:

enter image description here

...and here're my selected RibbonTypes:

enter image description here enter image description here

Out of sheer curiosity I turned on the StartFromScratch property, and my button does display without error under that configuration:

enter image description here

I can also start a new email (using Ctrl+N) without the previous error message.

Here's the XML from my ribbon export:

<?xml version="1.0" encoding="UTF-8"?>
<customUI onLoad="Ribbon_Load" xmlns="http://schemas.microsoft.com/office/2006/01/customui">
  <ribbon>
    <tabs>
      <tab idMso="TabAddIns">
        <group id="Group1" label="Group1">
          <button id="Button1" label="Click Me" showImage="false" />
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

After wiring up the Override in the new Ribbon.vb, there's no improvement in the overall situation when I use an XML ribbon vs. the ribbon designer.

Is my Outlook setup broken somehow? It sure feels like it.


Solution

  • First, try to unregister and then register the add-in back by running the Clean command of your add-in project and then Build to register it back.

    By default, if a VSTO Add-in attempts to manipulate the Microsoft Office user interface (UI) and fails, no error message is displayed. However, you can configure Microsoft Office applications to display messages for errors that relate to the UI. You can use these messages to help determine why a custom ribbon does not appear, or why a ribbon appears but no controls appear. For Outlook, the Show VSTO Add-in user interface errors checkbox is located in the Developer section of the details pane.

    There are two ways of creating a custom ribbon UI with VSTO:

    1. Walkthrough: Create a custom tab by using the Ribbon Designer
    2. Walkthrough: Create a custom tab by using Ribbon XML

    Second, if you use the ribbon designer you need to check whether the Add-ins tab is visible on the ribbon or not. So, you may try to place your controls to the custom tab. Just click on the right hand side of your ribbon tab on the designer surface to add a custom tab. Also you may try to change ribbon controls IDs.

    The last resort is to export your custom ribbon UI to the ribbon XML and troubleshoot the UI using callbacks. See How to: Export a ribbon from the Ribbon Designer to Ribbon XML for more information.