Sunday, December 11, 2011

Custom Ribbon Menu in SharePoint 2010

Feature.xml

<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
Id="031FE880-77CF-4A84-8C5C-7324229EDC6D"
Title="List Document Merge Custom Ribbon Button"
Scope="Web"
Description="List Document Merge Custom Ribbon Button"
ImageUrl="DOC32.GIF">

<ElementManifests>

<ElementManifest Location="RibbonButton.xml"/>

</ElementManifests>

</Feature>

RibbonButton.xml

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

<CustomAction
Id="ListDocumentMergeCustomRibbonButton"
RegistrationId="101"
RegistrationType="List"
Location="CommandUI.Ribbon"
Sequence="5"
Title="Merge Documents"
Rights="ViewListItems" xmlns="http://schemas.microsoft.com/sharepoint/"
>
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Documents.Manage.Controls._children">
<Button
Id="Ribbon.Documents.New.ListDocumentButton"
Alt="Merge Documents"
Sequence="5"
Command="ListDocumentMerge_Test_Button"
Image32by32="/_layouts/images/DOC32.GIF"
Image16by16="/_layouts/images/DOC32.GIF"
LabelText="Merge Documents"
TemplateAlias="o1" />
</CommandUIDefinition>
</CommandUIDefinitions>

<CommandUIHandlers>
<CommandUIHandler
Command="ListDocumentMerge_Test_Button"
CommandAction="~site/_layouts/ListDocumentMerge/DocumentMerge.aspx?List={ListId}&ID={SelectedItemId}" />
</CommandUIHandlers>

</CommandUIExtension>
</CustomAction>

</Elements>