none
Outlook add-in: add ribbon to Message tab (in the same window as the Explorer) RRS feed

  • Question

  • I'm trying to get a custom ribbon group to show up when I press reply to an email and I'm currently using control id "TabNewMailMessage". The problem is unless I'm composing the new mail message in a new window, I can't get the ribbon group to show up. By default, when replying to an email, no new window is opened. I would like the ribbon group to show up even when no new window is opened. Screen shot below:

    

    Thursday, June 8, 2017 10:01 PM

All replies

  • Hello,

    The tab is in the contextualTab of Explorer ribbon, we need to use Ribbon(XML) to customize the tab.

    The XML:

    <?xml version="1.0" encoding="UTF-8"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
      <ribbon>
        <contextualTabs>
          <tabSet idMso="TabComposeTools">
            <tab idMso="TabMessage">
               <group id="MyGroup" label="My Group">
              <button id="MyButton" imageMso="HappyFace" label="MyButton" size="large"/>   
              </group>  
            </tab>
          </tabSet>
        </contextualTabs>
      </ribbon>
    </customUI>
    

    in Ribbon.cs, edit

       public string GetCustomUI(string ribbonID)
            {
                //return GetResourceText("OutlookAddIn.Ribbon2.xml");
                string ribbonXML = String.Empty;
    
                if (ribbonID == "Microsoft.Outlook.Explorer") //Explorer
                {
                    ribbonXML = GetResourceText("OutlookAddIn.Ribbon2.xml");
                }
    
                return ribbonXML;
    
            }
    

    In ThisAddIn.cs, add

            protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
            {
                return new Ribbon2();
            }

    Ribbon designer and ribbon xml could not be used at the same time, so if you are customizing ribbon using designer, I suggest you export it into xml.  Please visit How to: Export a Ribbon from the Ribbon Designer to Ribbon XML

    In Outlook, we need to specify its ribbon id when GetCustomUI. For more information, please visit Extending the User Interface in Outlook 2010

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Venexz Sunday, June 10, 2018 6:31 AM
    Friday, June 9, 2017 2:57 AM
    Moderator