4/30/2011

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>




0 comments: