Add a Ribbon button to document set Ribbon Sharepoint 2010
If you want that the a custom ribbon button should appear on all document set content types then set the RegistrationId to the base document set content type ID else if you want the button to appear on a perticular document set content type the RegistrationID should be the ID of the document set content type that you want this ribbon button to appear on.
In the below example i have added a ribbon button to all the document set content types( i.e. it will appear on all the document sets's ribbon). The button below will download a document set as a zip file on click ofcourse.
Element.xml -
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="Ribbon.Documents.DocsetZip"
Title="Download Document Set as ZIP"
RegistrationType="ContentType"
RegistrationId="0x0120D520"
Location="CommandUI.Ribbon"
>
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.ManageDocumentSet.MDS.Manage.Controls._children">
<Button
Id="Ribbon.ManageDocumentSet.MDS.Manage.Controls.DownasZip"
Sequence="20"
Command="Ribbon.ManageDocumentSet.MDS.Manage.DownZip"
Alt="Download as ZIP"
Image1="/_layouts/images/img1.png"
Image2="/_layouts/images/img2.png"
LabelText="Download ZIP file"
ToolTipTitle="Download as ZIP file"
ToolTipDescription=" Download document set"
TemplateAlias="o1"
/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="Ribbon.ManageDocumentSet.MDS.Manage.DownZip"
CommandAction="javascript:__doPostBack('DownloadZipDelegateEvent', '')" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
</Elements>
Feature.xml -
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
Id="{CC0EB36F-B2AS-3627-893C-DC2F638475G2}"
Title="Add new button"
Description="Add new button to ribbon"
Version="1.0.0.0"
Scope="Web"
Hidden="TRUE">
<ElementManifests>
<ElementManifest Location="element.xml" />
</ElementManifests>
</Feature>
In the below example i have added a ribbon button to all the document set content types( i.e. it will appear on all the document sets's ribbon). The button below will download a document set as a zip file on click ofcourse.
Element.xml -
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="Ribbon.Documents.DocsetZip"
Title="Download Document Set as ZIP"
RegistrationType="ContentType"
RegistrationId="0x0120D520"
Location="CommandUI.Ribbon"
>
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.ManageDocumentSet.MDS.Manage.Controls._children">
<Button
Id="Ribbon.ManageDocumentSet.MDS.Manage.Controls.DownasZip"
Sequence="20"
Command="Ribbon.ManageDocumentSet.MDS.Manage.DownZip"
Alt="Download as ZIP"
Image1="/_layouts/images/img1.png"
Image2="/_layouts/images/img2.png"
LabelText="Download ZIP file"
ToolTipTitle="Download as ZIP file"
ToolTipDescription=" Download document set"
TemplateAlias="o1"
/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="Ribbon.ManageDocumentSet.MDS.Manage.DownZip"
CommandAction="javascript:__doPostBack('DownloadZipDelegateEvent', '')" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
</Elements>
Feature.xml -
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
Id="{CC0EB36F-B2AS-3627-893C-DC2F638475G2}"
Title="Add new button"
Description="Add new button to ribbon"
Version="1.0.0.0"
Scope="Web"
Hidden="TRUE">
<ElementManifests>
<ElementManifest Location="element.xml" />
</ElementManifests>
</Feature>
0 comments:
Post a Comment