Search code examples
outlookvstooutlook-addinoffice-addinsribbonx

VSTO Outlook 2016 using IRibbonExtensibility and dynamicMenu: Custom DropDown Menu does not open in certain cases


In our VSTO Outlook AddIn we have a DropDownMenu that does not open on the devices of two customers. Both use Outlook 2016 32-Bit. They have been reporting this for a few months now. Before they had not experienced this problem.

When the customers try to open it it looks like this:

Empty DropDown

The DropDownMenu is implemented using IRibbonExtensibility and dynamicMenu like this in ribbon id Microsoft.Outlook.Mail.Compose:

<?xml version="1.0" encoding="utf-8"?>
<customUI onLoad="Ribbon_Load" xmlns="http://schemas.microsoft.com/office/2009/07/customui">
    <ribbon>
        <tabs>
            <tab idMso="TabNewMailMessage">
                <group insertBeforeMso="GroupClipboard"
                       id="MyGroup"
                       label="Simba"
                       getVisible="IsAdvancedOutlookItemVisible" >
                    <dynamicMenu id="MyMenu"
                                 size="large"
                                 imageMso="AttachFile"
                                 getLabel="GetLabel"
                                 getContent="GetMenuContent"
                                 getEnabled="IsEnabled"
                                 invalidateContentOnDrop="true"
                                 />
                </group>
            </tab>
        </tabs>
    </ribbon>
</customUI>

We can not reproduce it inhouse.

We have found out that the GetMenuContent method is not called in these cases.

An interesting thing is that one customer reported that it happens only on a certain monitor. If he opens Outlook on another monitor the DropDownMenu is shown.

Maybe a bug in Outlook or do you have an idea what could go wrong here?


Solution

  • Finally I found the reason for this behavior:

    Actually as @Eugene guessed at the customer's system there is an exception thrown that is shown if outlook is configured to display the error messages. It told me that there is an illegal character in the xml content GetMenuContent() returned.

    I ran into the pifall since I directly built up the xml string and did not use something like XDocument. So there were illegal characters in the xml like ampersand that were not escaped.

    I could not find it earlier since the xml content was built up dynamically and only in rare cases customers had such illegal characters.