none
Custom ribbon button that is visible "everywhere" RRS feed

  • Question

  • Hi,

    I am trying to create a custom ribbon button that will be visible whenever its parent group is present. For the moment the only way I can make it visible is if I explicitly type RegistrationId and RegistrationType under CustomAction. Removing either or both results in the button dissapearing.

    Any help would be greatly appreciated! I have been googling for ages trying to find a solution.

    My elements.xml file:

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <!-- RegistrationId should be changed if the button should be visible on other lists (100 = Custom list)-->
      <CustomAction
        Id="Ribbon.Export.ExportToWord"
        Location="CommandUI.Ribbon"
        RegistrationId="100"
        RegistrationType="List"
        Sequence="5">
        <CommandUIExtension>
          <CommandUIDefinitions>
            <CommandUIDefinition Location="Ribbon.List.Actions.Controls._children">
              <Button Id="Ribbon.Export.ExportToWord.Btn"
                  Alt="Export selected to Word"
                  Description="Export the selected elements to a blank word document."
                  Sequence="5"
                  Command="Ribbon.Export.ExportToWord.Cmd"
                  Image32by32="Style Library/images/word_32.png"
                  Image16by16="Style Library/images/word_16.png"
                  LabelText="Export to Word"
                  TemplateAlias="o1"/>
            </CommandUIDefinition>
          </CommandUIDefinitions>
          <CommandUIHandlers>
            <CommandUIHandler
             Command="Ribbon.Export.ExportToWord.Cmd"
             CommandAction="javascript:void(SP.Custom.ExportToWord());"/>
          </CommandUIHandlers>
        </CommandUIExtension>
      </CustomAction>
    <Module Name="RibbonButton">
    </Module>
    </Elements>
    

    Monday, October 11, 2010 12:23 PM

Answers

All replies

  • For the registrationType you have the following options:
    • None

    • List

    • ContentType

    • ProgId

    • FileType

    Using one of those you have the registrationID that depends on it, for lists you can specify the listtemplate, for ContentType you can specify the contenttype id that should be used. You could use ContentType and the guid of a default listitem to attach it to? (Checkout: http://msdn.microsoft.com/en-us/library/ms460194.aspx)

    Monday, October 11, 2010 1:44 PM
  • Thanks for you reply.

    I tried using RegistrationType="ContentType" and RegistrationId="695b6570-a48b-4a8e-8ea5-26ea7fc1d162" (the default listitem) with no luck. I also tried explicitly setting RegistrationType="none" (with and without RegistrationId), but that didn't work either.

    Tuesday, October 12, 2010 11:38 AM
  • Checkout: http://msdn.microsoft.com/en-us/library/ff512775.aspx as you can see there to attach a ribbon to all documentsets you have to use:

    RegistrationType="ContentType"
    RegistrationId="0x0120D520"

    I would say you would need to use 0x0120 to attach it to all items.

    • Marked as answer by Ageris Tuesday, October 12, 2010 11:53 AM
    Tuesday, October 12, 2010 11:42 AM
  • That did it!

    Apparently I used the FeatureId from SharePoint Manager for the item content type :P

    Using:
    RegistrationType="ContentType"
    RegistrationId="0x01"

    Worked perfectly.


    Thanks a'million!

    Tuesday, October 12, 2010 11:55 AM
  • Awesome guys! Been looking for an answer to the same problem for a week already! One thing to note. I have a situation where I have several custom content types which all derive from one custom content type. So there's a base content type which contains several fields and all other custom content types derive from that content type so they will have the fields from the base content type and add some extra fields to it. For all lists based on the custom content types deriving from my base content type, I want the same Ribbon to appear. In this situation the answer provided in this topic is useful as well. Do note though that you need to use the GUID of your custom content type in uppercase .

    An example to make it more clear:

    My base custom content type carries the ID: 0x010010556630ee674816bc299ce16fa3e656

    My deriving custom content type carries the ID: 0x010010556630ee674816bc299ce16fa3e656 005fe345cb76a3417e9259742e3cc1ba7f (the space in between shouldn't be there but is added by the CMS of Technet, don't let it confuse you)

    Note that the Elements.xml created by Visual Studio 2010 generates a GUID in lowercase, as shown above.

    When using RegistrationType="ContentType" and RegistrationID="0x010010556630ee674816bc299ce16fa3e656" in my CustomAction XML containing my Ribbon definition it will not work . This is because internally SharePoint uses uppercase GUIDs. So when using the RegistrationID="0x010010556630EE 674816BC 299CE 16FA 3E 656" (in uppercase) it does work ! Now it will show in all content types that derive from my custom content type.

    Friday, October 15, 2010 2:54 PM
  • Thanks a lot.
    Wednesday, October 3, 2012 8:16 AM