Search code examples
visual-c++callbackoutlookribbonoutlook-addin

ribbon call back method implementaion in VSTO for outlook addin


i have to implement onbutton click activity in ribbon callback and i have this xml.

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

and i am using function like this in ribbon call back :

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 above code is not working ..

i think control is not going to that function it self..

please help ..

nikhil


Solution

  • Your callback method signature doesn't match what the Ribbon XML 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.");
        }
    }