none
How to create a new button in the ribbon

    Question

  • <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
     <CustomAction Id="Ribbon.List.Actions.AddAButton" Location="CommandUI.Ribbon" RegistrationId="100" RegistrationType="List" Title="My Custom Ribbon Button">
      <CommandUIExtension>
       <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.List.Actions.Controls._children">
         <Button Id="Ribbon.List.Actions.NewRibbonButton" Command="MyNewRibbonButtonCommand" LabelText="My custom button" TemplateAlias="o1"/>
        </CommandUIDefinition>
       </CommandUIDefinitions>
       <CommandUIHandlers>
        <CommandUIHandler Command="MyNewRibbonButtonCommand" CommandAction="javascript:alert('This is my custom button!');" />
       </CommandUIHandlers>
      </CommandUIExtension>
     </CustomAction>
    </Elements>

    With this code i create a new button in the ribbon:

     

    And i get the following result:

    http://img801.imageshack.us/img801/9448/sshotj.png

    How can i place my button inside a different tab or in a different position in the ribbon?

    Monday, October 18, 2010 9:56 AM

Answers

All replies