chrillelundmark
chrillelundmark

Reputation: 345

How to create a dynamic submenu in contextmenu for outlook (VSTO)

I have a ribbon xml where I want to add something similar as in the picture. I tried create a button and connect the menu to the button but I never got the arrow indication there is a underlying menu. I have no faith at all in that button is the correct element to use. Been googling for hours now and would be happy if anyone can send me in some kind of direction. There is no problem for me to add the element in the context menu, the problem is the dynamic menu linked to the first element.

enter image description here

Upvotes: 0

Views: 865

Answers (1)

Chris
Chris

Reputation: 3529

The control type you're looking for is dynamicMenu

Here is the ribbon XML:

<dynamicMenu id="mycustomid" label="My custom label" getContent="GetMyCustomContent" />

And the code:

public string GetMyCustomContent(IRibbonControl control)
{
    return "<menu xmlns=\"http://schemas.microsoft.com/office/2009/07/customui\">"
        + "<button id=\"anotherid\" label=\"another label\" onAction=\"DoWhatever\"/>"
        + "</menu>";
}

public string DoWhatever(IRibbonControl control)
{
}

Upvotes: 1

Related Questions