none
Add a button that opens a url in the "Home" tab ribbon. RRS feed

  • Question

  • I need to add a button to the ribbon that is displayed when the "home" tab is clicked in Outlook 2010.

    I have absolutely no idea as to how to start with this.

    I read this is possible, but from where do I get the xml files. And how is it deployed after being modified? What do I need to install?

    The requirement is to add this button in the existing ribbon in Outlook 2010 and 2013. And am using Visual studio 2012.

    Any links, ideas would be of a lot of help.

    Thanks in advance.

    Saturday, April 19, 2014 5:47 AM

Answers

  • Dear Lady,

    > If I decide not to go the XML way, since Ribbon designer caters to my requirement, is it enough that I make the change, build the project and run it? 

    Yes, it is. You just need to add a Ribbon Designer item to the Outlook add-in project in Visual Studio. Do the required changes and build the project to get the add-in registered for running in Outlook.

    See Adding the Custom Group to a Built-in Tab section. It looks like this is exactly what you are looking for.

    > Or is there something else that needs to be done?

    Nothing. Please re/read all the mentioned articles above.


    • Edited by Eugene Astafiev Saturday, April 19, 2014 5:41 PM
    • Marked as answer by .NetLady Sunday, April 20, 2014 10:40 AM
    Saturday, April 19, 2014 3:42 PM

All replies

  • Hello,

    You need to specify the IdMso (TabMail) value of the built-in tab to get your controls added to the Home ribbon tab. You can find the list of built-in control IDs in the Office 2013 Help Files: Office Fluent User Interface Control Identifiers and Office 2010 Help Files: Office Fluent User Interface Control Identifiers  documents. 

    See How to: Customize the Ribbon . Also you may find the Customize Outlook UI with VSTO Ribbon designer (CSOutlookUIDesigner) sample add-in project helpful.

    You can find a lot of HowTo articles in MSDN, see the Ribbon Overview section. The How to: Customize a Built-in Tab page describes exactly what you need to implement.

    The following series of articles describes the Ribbon UI in depth:

    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)

    Saturday, April 19, 2014 7:00 AM
  • Thanks Eugene for giving me these links. I'll get started.

    Saturday, April 19, 2014 7:13 AM
  • Ok, So here is what I've done till now -

    1) Created a new project Outlook AddIn in Visual studio.

    2) Created a ribbon, added a button to the default group. Made a few property changes as per the "Customize a built-in tab" article from msdn.

    3) Selected "Export Ribbon to XML". So the xml is the output of this. I'm not sure if this is right way to do it.

    The code is on click of the referrals button is -

    namespace OutlookAddIn1

    {

        public partial class Ribbon1

        {

            private void Ribbon1_Load(object sender, RibbonUIEventArgs e)

            {

            }

            private void btnReferrals_Click(object sender, RibbonControlEventArgs e)

            {

                string myURL = "http://www.msdn.com";

                System.Diagnostics.Process.Start(myURL);

            }

        }

    }

    And the Ribbon.xml is as below -

    <?xml version="1.0" encoding="UTF-8"?>

    <customUI onLoad="Ribbon_Load" xmlns="http://schemas.microsoft.com/office/2006/01/customui">

        <ribbon>

            <tabs>

              <tab idMso="TabMail">

                    <group id="group1" label="group1">

                        <button id="btnReferrals" onAction="btnReferrals_Click" label="button1" size="large" />

                    </group>

                </tab>

            </tabs>

        </ribbon>

    </customUI>

    Now when I run the solution, it opens Outlook 2010 but doesn't show me the addIn anywhere. I also tried "Customise ribbon" and added it.

    Also set the position of this to - AfterOfficeId GroupContactFind.

    What am I missing? 

    Shouldn't I be able to see the group with the button on TabMail? Again any ideas would be helpful. 

    Thanks.

    Saturday, April 19, 2014 9:29 AM
  • There is no need to export the ribbon UI to a raw markup XML. However, the Ribbon (Visual Designer) item does not support all possible types of Ribbon customization. To customize the Ribbon in advanced ways, you can export the Ribbon from the designer to Ribbon XML and edit the XML directly. In most cases using the Ribbon designer is enough. Did you have a chance to look at the sample add-in project I mentioned in my previous post there?

    See How to: Export a Ribbon from the Ribbon Designer to Ribbon XML if you need to export your designed UI to a raw XML markup. It describes the required steps to get the Ribbon XML markup working.

    Saturday, April 19, 2014 1:37 PM
  • I did download the project that you referenced, but am having issues opening it in VS 2012. Looks like an older version issue. Am trying to figure out if I can tweak the .csproj file.

    I'll check this other link and try it out now. Thanks again for helping out.

    Saturday, April 19, 2014 2:17 PM
  • Hi Eugene,

    I can access the project files of that project you mentioned. Is there any part of the code that I need to take notice of and do the same in my project?

    And another question, If I decide not to go the XML way, since Ribbon designer caters to my requirement, is it enough that I make the change, build the project and run it? 

    Or is there something else that needs to be done? I'm sorry for asking some silly questions here, but I have not done this before and need a working solution by Monday. And so all the hurry to get it done.

    Thanks.

    Saturday, April 19, 2014 2:43 PM
  • Dear Lady,

    > If I decide not to go the XML way, since Ribbon designer caters to my requirement, is it enough that I make the change, build the project and run it? 

    Yes, it is. You just need to add a Ribbon Designer item to the Outlook add-in project in Visual Studio. Do the required changes and build the project to get the add-in registered for running in Outlook.

    See Adding the Custom Group to a Built-in Tab section. It looks like this is exactly what you are looking for.

    > Or is there something else that needs to be done?

    Nothing. Please re/read all the mentioned articles above.


    • Edited by Eugene Astafiev Saturday, April 19, 2014 5:41 PM
    • Marked as answer by .NetLady Sunday, April 20, 2014 10:40 AM
    Saturday, April 19, 2014 3:42 PM
  • Ok. I'll read up all the articles first. 

    Many thanks Eugene for the clarifications.

    Saturday, April 19, 2014 5:01 PM
  • Thanks Eugene for helping out. I was going wrong with the positioning of the main "officeRibbon" control.

    Fixed that and it works fine.

    Sunday, April 20, 2014 10:43 AM