none
add button to outlook message tab using custom ui xml RRS feed

  • Question

  • I want to add button to Message tab using custom ui xml,but I am able to add it to backstage only

    here is code im using

    <?xmlversion="1.0"encoding="UTF-8"?>

    <customUIonLoad="Ribbon_Load"xmlns="http://schemas.microsoft.com/office/2009/07/customui">

    <backstage>

    <tabid="MyBackstage"  label="MyBackstage"columnWidthPercent="30"  insertAfterMso="TabInfo"visible="true"> <firstColumn>

         

    <primaryItem>

    <buttonid="buttonBackStage"label="button Backstage"onAction="buttonBackStage_Click"/>

     </group>

    <firstColumn><tab></backstage></customUI>

    </primaryItem>
    <groupid="grpOne"label="Group >

    any help is appreciated.
    • Edited by Max Meng Monday, May 21, 2012 4:36 AM format
    • Moved by Max Meng Monday, May 21, 2012 4:52 AM Moving to a more appropriate forum (From:Outlook IT Pro Discussions)
    Friday, May 18, 2012 4:54 PM

Answers

  • you have to define in your xml that you want to add button to message tab, not to backstage, sample:

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="OnLoad"> <ribbon> <tabs> <tab idMso="TabNewMailMessage"> <group id="GroupNew" label="my label"

    insertBeforeMso="GroupClipboard"> <button id="buttonid"

    size="large"

    label="my button" /> </group> </tab> </tabs> </ribbon> </customUI>

    remember to add it to both

    Microsoft.Outlook.Mail.Compose

    and

    Microsoft.Outlook.Mail.Read


    • Marked as answer by nandiniphx Wednesday, May 23, 2012 6:05 PM
    Monday, May 21, 2012 7:56 AM
  • Hi nandipiphx,

    Thanks for posting in the MSDN Forum.

    First, you need set your tab in <ribbon><tabs>...</tabs></ribbon>.

    Second, there can't use <firstColumn> tag.

    Thrid, you need edit GetCustomUI method in your Ribbon class. This is a sample:

            public string GetCustomUI(string ribbonID)
            {
                string result = null;
                switch (ribbonID)
                {
                    case "Microsoft.Outlook.Mail.Read":
                        result = GetResourceText(
    "OutlookAddIn25.OutlookAddIn25Ribbon.xml");
                        break;
                }
                return result;
            }

    Forth, you need following Ribbon Xml

    <?xml version="1.0" encoding="UTF-8"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
      <ribbon>
        <tabs>
          <tab idMso="TabReadMessage">
            <!-- To Do: Add you control -->
          </tab>
        </tabs>
      </ribbon>
    </customUI>

    I hope it can help you.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by nandiniphx Wednesday, May 23, 2012 6:05 PM
    Monday, May 21, 2012 7:49 AM
    Moderator
  • Thanks guys...u just saved my head from exploding....Wow finally I got it Thanks  thanks

    nandini

    • Marked as answer by nandiniphx Wednesday, May 23, 2012 6:05 PM
    Monday, May 21, 2012 3:22 PM
  • if you got response that satisfy your needs, please mark an answer to close the thread:)
    • Marked as answer by nandiniphx Wednesday, May 23, 2012 6:05 PM
    Monday, May 21, 2012 6:00 PM

All replies

  • Since this is an Outlook development issue, so I have moved it to Outlook for Developers forum.
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who the forums regularly can either share their knowledge or learn from your interaction with us.

    Thank you for your understanding.


    Max Meng

    TechNet Community Support

    Monday, May 21, 2012 4:51 AM
  • Hi nandipiphx,

    Thanks for posting in the MSDN Forum.

    First, you need set your tab in <ribbon><tabs>...</tabs></ribbon>.

    Second, there can't use <firstColumn> tag.

    Thrid, you need edit GetCustomUI method in your Ribbon class. This is a sample:

            public string GetCustomUI(string ribbonID)
            {
                string result = null;
                switch (ribbonID)
                {
                    case "Microsoft.Outlook.Mail.Read":
                        result = GetResourceText(
    "OutlookAddIn25.OutlookAddIn25Ribbon.xml");
                        break;
                }
                return result;
            }

    Forth, you need following Ribbon Xml

    <?xml version="1.0" encoding="UTF-8"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
      <ribbon>
        <tabs>
          <tab idMso="TabReadMessage">
            <!-- To Do: Add you control -->
          </tab>
        </tabs>
      </ribbon>
    </customUI>

    I hope it can help you.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by nandiniphx Wednesday, May 23, 2012 6:05 PM
    Monday, May 21, 2012 7:49 AM
    Moderator
  • you have to define in your xml that you want to add button to message tab, not to backstage, sample:

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="OnLoad"> <ribbon> <tabs> <tab idMso="TabNewMailMessage"> <group id="GroupNew" label="my label"

    insertBeforeMso="GroupClipboard"> <button id="buttonid"

    size="large"

    label="my button" /> </group> </tab> </tabs> </ribbon> </customUI>

    remember to add it to both

    Microsoft.Outlook.Mail.Compose

    and

    Microsoft.Outlook.Mail.Read


    • Marked as answer by nandiniphx Wednesday, May 23, 2012 6:05 PM
    Monday, May 21, 2012 7:56 AM
  • Thanks guys...u just saved my head from exploding....Wow finally I got it Thanks  thanks

    nandini

    • Marked as answer by nandiniphx Wednesday, May 23, 2012 6:05 PM
    Monday, May 21, 2012 3:22 PM
  • if you got response that satisfy your needs, please mark an answer to close the thread:)
    • Marked as answer by nandiniphx Wednesday, May 23, 2012 6:05 PM
    Monday, May 21, 2012 6:00 PM