vstooutlook-addinoutlook-2010

Open a Outlook ribbon control programatically


I am working on a C# Office COM Addin that has an adjoining form region that is associated with the Appointment message class. I am trying to open the Recurrence toggle button on the ribbon through code. I've tried Office.CommandBars interface and FindControl() to reference the control through its control id. But it does not work. Any help will be appreciated. Thanks in advance.


Solution

  • There is no need to use Accessibility API or Redemption in that case.

    The ExecuteMso method of the Command bars class allows to execute built-in controls on the Ribbon. Try to use the following code while the Recurrence toggle button is displayed on the ribbon:

    commandBars.ExecuteMso("Recurrence");
    

    The command bars object should come from the Explorer or Inspector objects, depends on where the target control come from. See Office 2013 Help Files: Office Fluent User Interface Control Identifiers for more IdMso values.