views:

50

answers:

2

I have some problems adding a new custom button to the ribbon. As explained in the sharepoint 2010 SDK (How to: Modify the User Interface Using Custom Actions), i've created a visual studio project and copied the xml code which should create the new button. Here is the code:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
  <CustomAction Id="ListViewCustomization" Location="CommandUI.Ribbon.ListView" RegistrationId="101" RegistrationType="List" Title="List View Ribbon Customization">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.Documents.Share.Controls._children">
          <Button Id="ListViewButton" Command="ListViewButtonCommand" Description="Go to Settings" LabelText="Site Settings" TemplateAlias="o2" Sequence="93"/>
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler Command="ListViewButtonCommand" CommandAction="/_layouts/settings.aspx" />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
</Elements>

I've checked the site settings of my site collection, and the new feature results activated, but no new button around. Am i missing some steps?

+1  A: 

Are you sure the button is not there?

I followed instructions from the How to: Modify the User Interface Using Custom Actions article and here's the result:

alt text

Marek Grzenkowicz
+1  A: 

If I follow the steps, I see a button in the ribbon under "Share & Track" group.

I hope you are checking in a Document Library and not anywhere else. Remember, you have customized only the document library by specifying RegistrationId="101" in the xml file.

Ashish Patel
Holy cow you're right, that button is there! Obviously i wasn'looking at a document library, but instead at a list (because the title was "Add a Button to the LIST Form"). So how can i add that button to the list tab? what RegistrationId do i need?
Maik
@Maik SharePoint List Template IDs http://sharepointkb.wordpress.com/2008/08/26/sharepoint-list-template-ids-registrationids-list-template-type-ids/
Marek Grzenkowicz
Actually, that ID represents a List Template ID. So it depends whether you are using a Custom List Template (in which case you would have your own ID) or you created the list from one of the existing list templates. If you created the list from existing list template, you need to find list template id for the list template. Check "ListTemplateType Enumeration" in Sharepoint SDK
Ashish Patel
Ok thanks, i have a custom list, so i use ID 100 and it all works fine now =) But now it comes the difficult part: i need this button to be clickable only if one item in the list is selected, and i need that clicking it results in opening a window with the infos about that item (something like a link). Maybe someone of you has already done this, and could make my life simpler =)
Maik

related questions