none
Access Outlook ribbon's group items added using Ribbon(XML) on runtime RRS feed

  • General discussion

  • Hi Folks,

    I am working on a POC for Outlook add in, basically to compare the feature and feasibilities of Designer(VSTO) and Ribbon(XML).

    Where both of these are having their own limitation around the object models, which are exposed to developers to use.

    The designer generated Ribbon inherits from RibbonBase and is added to Globals.Ribbon collection and can be accessed as such like Globals.Ribbons.Ribbon1 (if ribbon name is Ribbon1). However, there is no such object added to the ribbon collection when other type of ribbon object IRibbonUI(Ribbon(XML)) is created but not using Ribbon Designer.

    I know it is possible very easily using VSTO, but is it not possible to access ribbon group's item(implemented using XML) runtime across the add in project ?

    • Edited by Rakeshr45 Thursday, June 18, 2015 9:12 AM
    Thursday, June 18, 2015 9:06 AM

All replies

  • Hello Rakesh,

    Why do you need to access the ribbon's group at runtime? What is the goal of doing so?

    Anyway, the Ribbon UI is a static thing from its birth. You can't work with ribbon controls as you did with command bars or Windows Forms controls (just setting their properties at any convenient time). Instead, you need to use callbacks. When you need to make change to the controls you may call the Invalidate or InvalidateControl methods of the IRibbonUI interface to force your callbacks invoked by the Office applications (because values are cached).

    Read more about the Fluent UI (aka Ribbon UI) in the following series of articles in MSDN:

    Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)

    Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)

    Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)

    To answer your question: there is no need to access the ribbon from any place. Instead, you can access your add-in class using the Globals.ThisAddIn property from the ribbon callbacks to update the UI accordingly.   

    Thursday, June 18, 2015 12:55 PM
  • Thanks Eugene !!
    Your explanation has indeed added more insight on static behaviour of Ribbon(XML), which I got during my initial investigation.
     
    So,here is the requirement to get an access of added(using IRibbonUI) ribbon group's items, which is possible using VSTO:

    1) We need our options available on main Outlook explorer, which are in the format of menu options and should be in a state of enabled or disabled(few) based on certain condition on runtime.

    2) We also have our separate buttons added under a new group of ribbon,which appears on a compose mail window. And from this window too user has the feasibility to make main windows options enable or disable but probably from another form.
    Also not sure how the Invalidate or InvalidateControl methods of the IRibbonUI interface can help here(because values are cached) as control state(enable/disable) of a specific item has to be changed but not the group.

    3) There are few options on these windows, which has certain events to enable/disable and assign the call backs to the added items of given group on runtime, but it has to take effect from the window(immediately)first you have initiated the actual event to the main window(Explorer).



    Implementation on above said functionality was made possible using just minimal piece of code, as we could get access to the added ribbon items from Ribbon collection from anywhere through out the add-in.
    • Edited by Rakeshr45 Friday, June 19, 2015 3:16 AM
    Friday, June 19, 2015 3:15 AM