Replacing Existing Ribbon Controls in SharePoint 2010

This is my personal format to replace a folder in Ribbon in SharePoint 2010 :

Code :

<?xml version="1.0" encoding="utf-8"?>

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

  <CustomAction
    Id="Ribbon.Documents.New.NewFolder.ReplaceButton"
    Location="CommandUI.Ribbon"
    RegistrationId="101"
    RegistrationType="List"
    Title="Replace Ribbon Button">

    <CommandUIExtension>

      <CommandUIDefinitions>

        <CommandUIDefinition
          Location="Ribbon.Documents.New.NewFolder">

          <Button Id="Ribbon.Documents.New.NewFolder.ReplacementButton"
            Command ="MyNewButtonCommand"
            Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png?vk=4536" 
            Image16by16Top="-240" Image16by16Left="-80"
            Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png?vk=4536" 
            Image32by32Top="-352" Image32by32Left="-448"
            ToolTipTitle="Create a New Folder"
            ToolTipDescription="Replaced by XML Custom Action"
            LabelText="My New Folder"
            TemplateAlias="o1" />

        </CommandUIDefinition>

      </CommandUIDefinitions>

      <CommandUIHandlers>

        <CommandUIHandler
          Command="MyNewButtonCommand"
          CommandAction="javascript:alert('New Folder Replaced.');" />

      </CommandUIHandlers>

    </CommandUIExtension>

  </CustomAction>

</Elements>
Advertisements

Tags: , , ,

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: