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 want my custom ribbon button to show in all list views. I found this example: How do you create a Ribbon Button custom action that will appear on all kinds of lists

However, this also shows the ribbon button in Forms (Add new item, etc.). I don't want it to appear there. Only in lists (calendar, tasks, custom, etc.), libraries (images, documents, site pages, etc.).

Thanks!

share|improve this question
add comment

1 Answer 1

up vote 6 down vote accepted

You can specify Location="CommandUI.Ribbon.ListView" and RegistrationType="ContentType" with ID set to 0x01 for custom button to appear on ListView pages of all the lists.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
  Id="ShowHelloWorldButton"
  RegistrationType="ContentType"
  RegistrationId="0x01"
  Location="CommandUI.Ribbon.ListView"
  Rights="EditListItems">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition
         Location="Ribbon.ListItem.Actions.Controls._children">
          <Button
           Id="Ribbon.ListItem.Actions.Controls.ShowHelloWorldButton"
           Alt="Show HelloWorld Alert"
           Sequence="1"
           Image32by32="/_layouts/DemoSharePointRibbon/HelloWorld.jpg"
           Command="ShowHelloWorldCommand"
           LabelText="Hello World"
           TemplateAlias="o1"
           CommandType="General"/>
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler
         Command="ShowHelloWorldCommand"
         CommandAction="javascript:alert('Hello World');" />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
</Elements>
share|improve this answer
    
Awesome dude! Thanks! –  Pathachiever11 Jun 2 '12 at 14:56
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.