none
How do I enable/disable my Ribbon Buttons in Outlook after ribbon loads RRS feed

  • Question

  • I have an Outlook Add-in created with VSTO C#. Using the Ribbon Designer I have created a tab with several controls (buttons etc) on it. (Environment: Outlook 2010/2007, .NET 4.0, VSTO 2010 runtime)

    I already read this: How do I enable/disable my Ribbon Buttons in Outlook but the answer seeems to suggest I need to convert to ribbon xml editor.

    I'm assuming I can update the enabled properties to false after the ribbon loads using the ribbon designer (NOT XML)? (I already have a ton of code in place). If that's the ONLY way I can get it to work, then that'll be helpful to know.

    Obviously already tried invalidate() - which ONLY works on the first inspector window, so it seems like it CAN work.

    thanks!!!

    Wednesday, May 8, 2013 6:00 PM

Answers

  • Hi neoswarm1,

    If your disable it in ribbon class please use button1.Enable = false.

    if you want disable it from out side. For example, if you want to do that at ThisAddIn_Start method. Please use following code:

                Type type = typeof(Ribbon1);
                Ribbon1 ribbon = Globals.Ribbons.GetRibbon(type) as Ribbon1;
                ribbon.button1.Enabled = false;

    I hope it can help you.

    Have a good day,

    Tom

    Thursday, May 9, 2013 6:57 AM
    Moderator