locked
To add custom ribbon tab with the existing custom ribbon tab RRS feed

  • Question

  • Hi,

    -I have created a custom ribbon tab and added button controls in to it. Now i need to add some more button controls with the existing tab that i already added.

    -For that i need to check that already a custom ribbon tab s existing or not.

    -Please do reply with the sample code.

    Lots of thanks in advance.

     

     

    • Moved by Kris Wagner - MVP Wednesday, August 17, 2011 12:25 PM posted to 2007 forum (From:SharePoint - Design and Customization (pre-SharePoint 2010))
    • Moved by Kris Wagner - MVP Wednesday, August 17, 2011 4:01 PM Moved (From:SharePoint 2010 - Using Visual Studio with SharePoint and other programming)
    Tuesday, August 9, 2011 6:59 AM

Answers

  • Old post, but ran into the same problem myself, the solution is:

    You need to specify the location to be: Ribbon.STab.SGroup.Controls._children

    (Not the group id).

    In your new wsp project:

    <CommandUIDefinition Location="Ribbon.STab.SGroup.Controls._children" >
        <Button Id="NewButton" />
    </CommandUIDefinition>

    Definition in your old wsp project:

    <Group Id="Ribbon.STab.SGroup" >
           <Controls Id="Ribbon.STab.SGroup.Controls" />
    </Group>


    • Edited by blarsen666 Thursday, October 4, 2012 9:27 AM
    • Proposed as answer by blarsen666 Thursday, October 4, 2012 10:17 AM
    • Marked as answer by Margriet Bruggeman Monday, October 22, 2012 7:18 AM
    Thursday, October 4, 2012 9:26 AM

All replies

  • How did you added the Ribbon in SP 2007? without know how you made that i think will be hard to understand what you want...

     

    Kind regards,


    André Lage Microsoft SharePoint, CRM and Sybase Consultant
    Blog:http://aaclage.blogspot.com
    Codeplex:http://spupload.codeplex.com/http://simplecamlsearch.codeplex.com/
    Tuesday, August 9, 2011 7:22 AM
  • Hi Andre Lage:

    -i using sharepoint 2010.

    -created an empty element in that  i added custom ribbon tab by using the folling code:

    --Elements.xml

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <CustomAction
        Id="STab"
        Location="CommandUI.Ribbon.ListView"
        RegistrationId="101"
        RegistrationType="List">
        <CommandUIExtension>
          <CommandUIDefinitions>
            <CommandUIDefinition
              Location="Ribbon.Tabs._children">
              <Tab
                Id="Ribbon.STab"
                Title="S"
                Sequence="501">
                <Scaling
                  Id="Ribbon.STab.Scaling">
                  <MaxSize
                    Id="Ribbon.STab.MaxSize"
                    GroupId="Ribbon.STab.SGroup"
                    Size="FiveLarge"/>
                  <Scale
                    Id="Ribbon.STab.Scaling.SScaling"
                    GroupId="Ribbon.STab.SGroup"
                    Size="FiveLarge" />
                </Scaling>
                <Groups Id="Ribbon.STab.Groups">
                  <Group
                    Id="Ribbon.STab.SGroup"
                    Title="Excel Groups"
                    Sequence="52"
                  
                    Template="Ribbon.Templates.SExcelTemplate">
                    <Controls Id="Ribbon.STab.SGroup.Controls">
                      <Button
                        Id="Ribbon.STab.SGroup.Excelpdf"
                        Command="STab.Excelpdf"
                        Sequence="15"
                        Image32by32="/_layouts/images/SDocExcelExports/excel to pdf.PNG"
                        LabelText="Excel To PDF"
                        TemplateAlias="Excelpdf"/>
                      <Button
                        Id="Ribbon.STab.SGroup.ExcelHtml"
                        Command="STab.ExcelHtml"
                        Sequence="17"
                        Image32by32="/_layouts/images/SDocExcelExports/excel to html.PNG"
                        LabelText="Excel To HTML"
                        TemplateAlias="ExcelHtml"/>
                      <Button
                        Id="Ribbon.STab.SGroup.ExcelImage"
                        Command="STab.ExcelImage"
                        Sequence="19"
                        Image32by32="/_layouts/images/SDocExcelExports/excel to image.PNG"
                        LabelText="Excel To Image"
                        TemplateAlias="ExcelImage"/>
                      <Button
                        Id="Ribbon.STab.SGroup.Excelxml"
                        Command="STab.Excelxml"
                        Sequence="21"
                        Image32by32="/_layouts/images/SDocExcelExports/excel to xml.PNG"
                        LabelText="Excel To Xml"
                        TemplateAlias="Excelxml"/>
                      <Button
                        Id="Ribbon.STab.SGroup.ExcelCSV"
                        Command="STab.ExcelCSV"
                        Sequence="23"
                        Image32by32="/_layouts/images/SDocExcelExports/excel to csv.PNG"
                        LabelText="Excel To CSV"                   
                        TemplateAlias="ExcelCSV"/>
                    </Controls>
                  </Group>
                  <Group
                   Id="Ribbon.STab.SDocGroup"
                   Title="Doc Groups"
                   Sequence="63"              
                   Template="Ribbon.Templates.SDocTemplate">
                    <Controls Id="Ribbon.STab.SDocGroup.Controls">
                      <Button
                        Id="Ribbon.STab.SDocGroup.DocEpub"
                        Command="STab.DocEpub"
                        Sequence="25"
                        Image32by32="/_layouts/images/SDocExcelExports/word to epub.PNG"
                        LabelText="Doc To EPUB"
                        TemplateAlias="DocEpub"/>
                      <Button
                        Id="Ribbon.STab.SDocGroup.DocHtml"
                        Command="STab.DocHtml"
                        Sequence="27"
                        Image32by32="/_layouts/images/SDocExcelExports/word to html.PNG"
                        LabelText="Doc To HTML"
                        TemplateAlias="DocHtml"/>
                      <Button
                        Id="Ribbon.STab.SDocGroup.DocPdf"
                        Command="STab.Docpdf"
                        Sequence="29"
                        Image32by32="/_layouts/images/SDocExcelExports/word to pdf.PNG"
                        LabelText="Doc To PDF"
                        TemplateAlias="Docpdf"/>
                      <Button
                        Id="Ribbon.STab.SDocGroup.DocRTF"
                        Command="STab.DocRTF"
                        Sequence="31"
                        Image32by32="/_layouts/images/SDocExcelExports/word to rtf.PNG"
                        LabelText="Doc To RTF"
                        TemplateAlias="DocRtf"/>                 
                    </Controls>
                  </Group>
                </Groups>
              </Tab>
            </CommandUIDefinition>
            <CommandUIDefinition Location="Ribbon.Templates._children">
              <GroupTemplate Id="Ribbon.Templates.SExcelTemplate">
                <Layout
                  Title="FiveLarge"
                  LayoutTitle="FiveLarge">
                  <Section Alignment="Top" Type="OneRow">
                    <Row>
                      <ControlRef DisplayMode="Large" TemplateAlias="Excelpdf" />
                    </Row>
                  </Section>
                  <Section Alignment="Top" Type="OneRow">
                    <Row>
                      <ControlRef DisplayMode="Large" TemplateAlias="ExcelHtml" />
                    </Row>
                  </Section>
                  <Section Alignment ="Top" Type ="OneRow">
                    <Row>
                      <ControlRef DisplayMode="Large" TemplateAlias="ExcelImage" />
                    </Row>
                  </Section>
                  <OverflowSection Type="OneRow" TemplateAlias="Excelxml" DisplayMode="Large"/>
                  <OverflowSection Type="OneRow" TemplateAlias="ExcelCSV" DisplayMode="Large"/>
                </Layout>
              </GroupTemplate>         
            </CommandUIDefinition>
            <CommandUIDefinition Location="Ribbon.Templates._children">
              <GroupTemplate Id="Ribbon.Templates.SDocTemplate">
                <Layout
                  Title="FourLarge"
                  LayoutTitle="FourLarge">
                  <Section Alignment="Top" Type="OneRow">
                    <Row>
                      <ControlRef DisplayMode="Large" TemplateAlias="DocEpub" />
                    </Row>
                  </Section>
                  <Section Alignment="Top" Type="OneRow">
                    <Row>
                      <ControlRef DisplayMode="Large" TemplateAlias="DocHtml" />
                    </Row>
                  </Section>
                  <Section Alignment ="Top" Type ="OneRow">
                    <Row>
                      <ControlRef DisplayMode="Large" TemplateAlias="Docpdf" />
                    </Row>
                  </Section>
                  <OverflowSection Type="OneRow" TemplateAlias="DocRtf" DisplayMode="Large"/>            
                </Layout>
              </GroupTemplate>
            </CommandUIDefinition>
          </CommandUIDefinitions>
          <CommandUIHandlers>
            <CommandUIHandler
              Command="STab.Excelpdf"
              CommandAction="javascript:ExcelpdfConversion();"
               EnabledScript="javascript:enable();"/>
            <CommandUIHandler
              Command="STab.ExcelHtml"
              CommandAction="javascript:ExcelHtmlConversion();"
               EnabledScript="javascript:enable();"/>
            <CommandUIHandler
              Command="STab.ExcelImage"
              CommandAction="javascript:ExcelImageConversion();"
               EnabledScript="javascript:enable();"/>
            <CommandUIHandler
              Command="STab.Excelxml"
              CommandAction="javascript:ExcelxmlConversion();"
               EnabledScript="javascript:enable();"/>
            <CommandUIHandler
              Command="STab.ExcelCSV"
              CommandAction="javascript:ExcelCSVConversion();"
              EnabledScript="javascript:enable();"/>
            <CommandUIHandler
              Command="STab.DocEpub"
              CommandAction="javascript:DocEpubConversion();"
               EnabledScript="javascript:enable();"/>
            <CommandUIHandler
              Command="STab.DocHtml"
              CommandAction="javascript:DocHtmlConversion();"
               EnabledScript="javascript:enable();"/>
            <CommandUIHandler
              Command="STab.Docpdf"
              CommandAction="javascript:DocpdfConversion();"
               EnabledScript="javascript:enable();"/>
            <CommandUIHandler
              Command="STab.DocRTF"
              CommandAction="javascript:DocRTFConversion();"
               EnabledScript="javascript:enable();"/>
          </CommandUIHandlers>
        </CommandUIExtension>
      </CustomAction>
      <CustomAction
        Location="ScriptLink"
        ScriptSrc="/_layouts/SDocExcelExports/CustomAction07.js"/>
    </Elements>
    Regards,
    Karthick.R
    Tuesday, August 9, 2011 8:45 AM
  • Tuesday, August 9, 2011 9:32 AM
  • Hi Roi,

    -I had look on your post.

    -Thanks for your reply, But my requirement is something different i.e i already i created an custom tab with buttons and i deployed in my server by using its wsp file. Now i want to add some more custom buttons in to the same tab, by creating and deploying another wsp file in to the server.

    Regards,

    Karthick.R

    Tuesday, August 16, 2011 9:24 AM
  • Old post, but ran into the same problem myself, the solution is:

    You need to specify the location to be: Ribbon.STab.SGroup.Controls._children

    (Not the group id).

    In your new wsp project:

    <CommandUIDefinition Location="Ribbon.STab.SGroup.Controls._children" >
        <Button Id="NewButton" />
    </CommandUIDefinition>

    Definition in your old wsp project:

    <Group Id="Ribbon.STab.SGroup" >
           <Controls Id="Ribbon.STab.SGroup.Controls" />
    </Group>


    • Edited by blarsen666 Thursday, October 4, 2012 9:27 AM
    • Proposed as answer by blarsen666 Thursday, October 4, 2012 10:17 AM
    • Marked as answer by Margriet Bruggeman Monday, October 22, 2012 7:18 AM
    Thursday, October 4, 2012 9:26 AM