Answered by:
Having both Backstage and Ribbon in an addin

Question
-
Hi There,
I'm trying to figure out how to have both of these in one Addin. I can happily include either one in my Ribbon.XML object along with context menus but together they are mutually exclusive.
I've tried creating a second Ribbon.XML object for the backstage however I cannot find anyway to load this as CreateRibbonExtensibilityObject only returns one object. This feels like it should be something really obvious but I cannot figure it out and after an afternoon of looking for answers I thought I would leave a message here.
Thanks for any suggestions.
Sunday, September 27, 2015 5:42 PM
Answers
-
The CreateRibbonExtensibilityObject method should return an instance of the Microsoft.Office.Core.IRibbonExtensibility interface which has the GetCustomUI method where you can check out the parameter. For example:
public string GetCustomUI(string ribbonID) { string ribbonXML = String.Empty; if (ribbonID == "Microsoft.Outlook.Mail.Compose") { ribbonXML = GetResourceText("Trin_RibbonOutlookBasic.Ribbon1.xml"); } return ribbonXML; }
- Marked as answer by Cindy Meister MVP Monday, October 5, 2015 5:49 PM
Sunday, September 27, 2015 6:39 PM -
You need to combine your Outlook explorer ribbon customizations with backstage UI markup. For example:
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"> <ribbon startFromScratch="false"> <tabs> <tab> ... </tab> </tabs> </ribbon> <backstage> ... </backstage> </customUI>
and return such markup in case of the Microsoft.Outlook.Explorer value.
Also make sure that your markup is well-formed and you don't get any UI errors. See How to: Show Add-in User Interface Errors for more information.
- Proposed as answer by Starian chenMicrosoft contingent staff Friday, October 2, 2015 1:24 AM
- Marked as answer by Cindy Meister MVP Monday, October 5, 2015 5:50 PM
Wednesday, September 30, 2015 2:21 PM -
Okay I have an answer now that was posted for me but for some reason I cannot see here so I cannot mark that answer as correct.
The piece that was missing for me was the <ribbon startFromScratch="false"> attribute in the ribbon definition with the backstage definition following directly on. Once I did this the error in my XML vanished and I had backstage and ribbon in one XML file.
Many thanks for your help with this Eugene.
- Proposed as answer by Starian chenMicrosoft contingent staff Friday, October 2, 2015 1:24 AM
- Marked as answer by Cindy Meister MVP Monday, October 5, 2015 5:50 PM
Wednesday, September 30, 2015 7:50 PM
All replies
-
Hello Tre,
The IRibbonExtensibility interface provides the GetCustomUI method which should be implemented by add-ins in case they customize the Fluent UI.
public class Connect : Object, Extensibility.IDTExtensibility2, IRibbonExtensibility ... public string GetCustomUI(string RibbonID) { StreamReader customUIReader = new System.IO.StreamReader("C:\\RibbonXSampleCS\\customUI.xml"); string customUIData = customUIReader.ReadToEnd(); return customUIData; }
The RibbonID parameter identifies the context under which the custom ribbon is going to be loaded. So, you can return an appropriate ribbon markup. Read more about that in the Implementing the IRibbonExtensibility Interface article.
Also you may find the following articles in MSDN helpful:
Walkthrough: Creating a Custom Tab by Using Ribbon XML
Walkthrough: Creating a Custom Tab by Using the Ribbon Designer
Sunday, September 27, 2015 6:00 PM -
Many thanks but it looks like I'm too thick to get it!
With the ribbon designer I happily had multiple Ribbons working such that they showed up in different areas of the application. I presume just by setting to the backstage I could have done that too.
As I wanted to use context menus though I decided with this one to push through and learn Ribbon.XML like a grown up ;-) Man am I finding opaque to make it work? the documentation equally does not help.
Essentially I have the backstage ribbon defined, I just need to figure out how I get it to load.
Sunday, September 27, 2015 6:27 PM -
The CreateRibbonExtensibilityObject method should return an instance of the Microsoft.Office.Core.IRibbonExtensibility interface which has the GetCustomUI method where you can check out the parameter. For example:
public string GetCustomUI(string ribbonID) { string ribbonXML = String.Empty; if (ribbonID == "Microsoft.Outlook.Mail.Compose") { ribbonXML = GetResourceText("Trin_RibbonOutlookBasic.Ribbon1.xml"); } return ribbonXML; }
- Marked as answer by Cindy Meister MVP Monday, October 5, 2015 5:49 PM
Sunday, September 27, 2015 6:39 PM -
Many thanks, I think I get it now and I think it was obvious. I will try this out tonight and see if my understanding is correct.
Thanks for your patience.
Monday, September 28, 2015 7:51 AM -
Hi Eugene
So I am getting closer and I can surface different Ribbons in different areas but I'm still fighting the backstage.
The Docs say Microsoft.Outlook.Explorer is the RibbonID for Explorer Ribbons, Context menus and the backstage. This puts me right back to stage one as once again I have no way to load both an Explorer ribbon and a backstage.
Is there another RibbonID for the backstage I should know?
Tuesday, September 29, 2015 9:00 PM -
Hi,
It seems that you need multiple add-ins.
Wednesday, September 30, 2015 10:02 AM -
There is no need to develop multiple add-ins!
Try to include your backstage UI markup to the result XML markup. See Create Add-ins to Customize the Office 2010 Backstage View for more information.
- Edited by Eugene Astafiev Wednesday, September 30, 2015 10:27 AM
Wednesday, September 30, 2015 10:26 AM -
Could this be something wrong with my XML? At this point if I have a backstage defined first and I follow it with Ribbon I get an error and visa versa.
Am I missing something on the core <ribbon> or <backstage> definition that allows both to exist in the same XML file?
Currently I can only send one string from the GetCustomUI but am not allowed a string that contains both backstage and ribbon. One or the other works fine but not both.
Wednesday, September 30, 2015 12:03 PM -
You need to combine your Outlook explorer ribbon customizations with backstage UI markup. For example:
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"> <ribbon startFromScratch="false"> <tabs> <tab> ... </tab> </tabs> </ribbon> <backstage> ... </backstage> </customUI>
and return such markup in case of the Microsoft.Outlook.Explorer value.
Also make sure that your markup is well-formed and you don't get any UI errors. See How to: Show Add-in User Interface Errors for more information.
- Proposed as answer by Starian chenMicrosoft contingent staff Friday, October 2, 2015 1:24 AM
- Marked as answer by Cindy Meister MVP Monday, October 5, 2015 5:50 PM
Wednesday, September 30, 2015 2:21 PM -
Okay I have an answer now that was posted for me but for some reason I cannot see here so I cannot mark that answer as correct.
The piece that was missing for me was the <ribbon startFromScratch="false"> attribute in the ribbon definition with the backstage definition following directly on. Once I did this the error in my XML vanished and I had backstage and ribbon in one XML file.
Many thanks for your help with this Eugene.
- Proposed as answer by Starian chenMicrosoft contingent staff Friday, October 2, 2015 1:24 AM
- Marked as answer by Cindy Meister MVP Monday, October 5, 2015 5:50 PM
Wednesday, September 30, 2015 7:50 PM