Ribbon callback method in VSTO for Outlook addin

I need to implement onbutton click activity in a feed callback, and I have this xml.

<button id="GoToAppConfiguration" size="large" label="Application Configuration" imageMso="AutoArchiveSettings" onAction="OnActionCallback"/>

and I use a function like this in the feed callback:

public void OnActionCallback(Office.IRibbonControl control, bool isPressed)
    {
        if (control.Id == "GoToAppConfiguration")
        {
            MessageBox.Show("You clicked " + control.Id);
        }
        else
        {
            MessageBox.Show("You clicked a different control.");
        }
    }

but the above code does not work.

I think that management will not be for this function by itself.

please, help..

Nihil

+3
source share
1 answer

The signature of the callback method does not match what the XML feed is looking for . You need to omit the second parameter isPressed.

public void OnActionCallback(Office.IRibbonControl control)
{
    if (control.Id == "GoToAppConfiguration")
    {
        MessageBox.Show("You clicked " + control.Id);
    }
    else
    {
        MessageBox.Show("You clicked a different control.");
    }
}
+3
source

All Articles