Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm very new to to sharepoint and found a tutorial to allow me to create a custom action in order to place a button on the ribbon. I'm trying to use that to add a button to a list view but It isn't working.

Here is the tutorial xml to add a button to the shared doc library:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
       Id="DemoHelloWorldButton"
       RegistrationId="101"
       RegistrationType="List"
       Location="CommandUI.Ribbon"
       Sequence="5"
       Title="Hello World">
        <CommandUIExtension>
          <CommandUIDefinitions>
            <CommandUIDefinition
             Location="Ribbon.Documents.Manage.Controls._children">
              <Button
               Id="DemoHelloWorldButton"
               Alt="Hello World Ribbon Button"
               Sequence="10"
               Command="Demo_HelloWorld"
               Image32by32="/_layouts/images/MyProject/img.jpg"
               LabelText="Hello World Demo"
               TemplateAlias="o1"/>
            </CommandUIDefinition>
          </CommandUIDefinitions>
          <CommandUIHandlers>
            <CommandUIHandler
             Command="Demo_HelloWorld"
             CommandAction="javascript:alert('Hello World!');"
             />
          </CommandUIHandlers>
        </CommandUIExtension>
      </CustomAction>
    </Elements>

This works great, and following some instructions online I've tried using firebug to determine the location so that I can add it this for lists. Based on what I'm seeing in firebug I should be able to make this change:

<CommandUIDefinition Location="Ribbon.ListItem.Manage.Controls._children"/>

However this isn't working at all and I've been unable to find any help. Most of the examples online are the either the same Shared Docs example, or they are using list the way I am. Thank you for taking a look at my question.

share|improve this question
    
Please visit this post where a similar question has been asked - stackoverflow.com/questions/3720781/… –  Deepu Nair Jan 20 '12 at 4:24
    
Thank you for that link, it is definitely a similar problem. I checked it out and their issue is with the wrong location, and mine appears to be correct. –  samspot Jan 20 '12 at 15:57
add comment

1 Answer

up vote 3 down vote accepted

From your question it would seems that you need to add the new custom action button on list (your sample use a document library). If that is the case, you need to change the registation id from 101 (which identifies Document Library) to 100 (generic list). (Notice: please leave a comment if you needed something different or if this answer doesn't fully resolve your problem - I will try to update when I can).


About retriving your list RegistrationID. This blog post provides a list of ids for the main list templates found in SharePoint - haven't checked them all but they should be valid. Anyway, if any problem should arise, doublecheck with some other source as well.

Also, if the need should arise, you can use any tool like SharePoint manager to confirm the id of a given list. Simple navigate to the list and open the schema.xml tab. The value of the attribute "ServerTemplate" is the value you need.

share|improve this answer
    
I don't have enough rep to upvote, but this totally solved my problem. I thought the registrationId was just an Id for me to create, and some bad info that said it just needed to not be a multiple of 10 Definitely reinforced that notion. –  samspot Jan 20 '12 at 15:59
    
If you happen to check back and you know how to find the registration id for a particular list that would also be very helpful. Thanks! –  samspot Jan 20 '12 at 16:01
    
Yes, it will be my pleasure. Sorry to have you keept waiting, I will edit my answer to provide a brief list. –  SPArchaeologist Jan 23 '12 at 7:42
    
Thank you, you have been very helpful! I wish i could upvote more than once :) –  samspot Jan 23 '12 at 15:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.