SharePoint 2010: Extend the Document Library Menus, Ribbon and Settings Interface - SharePoint Development & Administration + InfoPath

Monday, November 7, 2011

SharePoint 2010: Extend the Document Library Menus, Ribbon and Settings Interface

In this tutorial I demonstrate how to customise the interface for Document Libraries in SharePoint 2010 using Custom Actions. I explain how to target specific types of Libraries built-in to SharePoint, and how to include additional links/actions to menus, the Server Ribbon and settings pages associated with Document Libraries.

This tutorial covers the following:

RegistrationId’s for Document Library types in SharePoint 2010
A list of Registration ID used to target specific types of Document Libraries built-in to SharePoint 2010 when adding new links / controls to the built in Interface.

1. Customise the Interface for the New Menu and Ribbon Group
  • 1.1 Add a link to the New Menu for a Document Library in SharePoint 2010
  • 1.2 Add a control to the “New” Group on the Ribbon for a Document Library in SharePoint 2010

2. Customise the Interface for the Actions Menu and Library Action Groups on the Ribbon
  • 2.1 Add a link to the Actions menu for a Document Library in SharePoint 2010
  • 2.2 Add a Control to the View Format Group on the Ribbon for a Document Library
  • 2.3 Add a Control to the “Connect & Export” group on the Ribbon for a Document Library (Document Library Actions)
  • 2.4 Customise the Share & Track Group

3. Customise the Settings Menu and Library Management / Settings Groups on the Ribbon
  • 3.1 Add a link to the Settings Menu for a Document Library in SharePoint 2010
  • 3.2 Add A Control to the Customise Library Group on the Ribbon for a Document Library
  • 3.3 Add A Control to the Settings Group on the Ribbon for a Document Library

4. Item Level Customisations to the Interface and Ribbon
  • 4.1 Add a link to the Edit Control Block (item drop-down) menu for a Document
  • 4.2 Add a Control to the “Manage” group on the Ribbon for Documents
  • 4.3 Add a Control to the “Share & Track” (Share) Group on the Ribbon for a Document Library
  • 4.4 Add a Control to the “Workflows” Group on the Ribbon for a Document Library

5. Customise the Document Library Settings Page
  • 5.1 Add a link to the Settings Page for a Document Library in SharePoint 2010




RegistrationId’s for Document Library types in SharePoint 2010
Each type of Document Library that ships with SharePoint 2010 has a unique Registration ID that can be used to target a specific type of Library when extending the user interface. The table below provides a list of the Registrations ID’s for common types of Libraries in SharePoint 2010. 




RegistrationIdType / Description
101Document Library: inc. Shared Documents, Site Assets, Style Library, Templates, Reporting Templates
109Picture Library
110Data Source Library
111Site Template Gallery
113Web Part Gallery
114List Template Gallery
115Form Library
116Master Page Gallery
117Workflows (site folder / library where workflows are located)
119Site Pages, Wiki Library
212Workspace Pages
851Images (Publishing Images, Site Collection Images), Asset Library


The Registration ID “101” is used in each example included in this tutorial, which is for a standard Document Library. To include new custom actions / links in the Ribbon or menus for other types of Libraries in SharePoint, you should use the Registration ID from the table above that corresponds to the type of library.

You can find the Registration ID’s of features such as Document Libraries from the “Type” attribute of the ListTemplate element found in the Element Manifest (XML) file for each type in the /TEMPLATES/FEATURES/ directory of the 14 (or 12) hive, or SPListTemplateType enum.
(eg. Type=”101” for the standard Document Library: /14/TEMPLATE/FEATURES/DocumentLibrary/ListTemplates/DocumentLibrary.xml).  An example of how to obtain a list of RegistrationIds from the SPListTemplate enumeration is provided later in the part.

1. Customise the Interface for the New Menu and Ribbon Group
1.1 Add a link to the New Menu for a Document Library in SharePoint 2010
The following CustomAction will be added to the New Menu for Document Libraries. As this menu is often not displayed by default for Libraries in SharePoint 2010, you may want to include the Custom Action in the “New” group on the Documents Tab instead which is demonstrated in the example (1.2).


<!-- New Menu : Example 1.1 -->  
<CustomAction  
Id="Microsoft.SharePoint.StandardMenu.NewMenu.CustomLink" 
  RegistrationType="List"  
RegistrationId="101"  
GroupId="NewMenu"  
Location="Microsoft.SharePoint.StandardMenu"  
Sequence="1101"  
Description="Adds a new Custom Action (link) to the New Menu of Document Libraries" 
Title="New Menu : Custom Link"> 
  <UrlAction Url="http://blog-sharepoint.blogspot.com/"/> 
</CustomAction>






CustomAction Registration ID: 101 (Document Library)
CustomAction Location: Microsoft.SharePoint.StandardMenu
CustomAction Group ID: NewMenu




1.2 Add a control to the “New” Group on the Ribbon for a Document Library in SharePoint 2010
This will add a new control to the New group on the Server Ribbon for Document Libraries.  as the Ribbon is more accessible in SharePoint 2010 to the New Menu as explained in example 1.1, I would recommend using this method (or both) to include a custom link or action in the New section for Document Libraries.



<!-- Ribbon - New Group : Example 1.2 --> 
<CustomAction 
 Id="Ribbon.Documents.New.Controls.CustomLink" 
 Location="CommandUI.Ribbon"  
RegistrationId="101"  
RegistrationType="List"  
Title="Add to Existing New Group on the Ribbon"> 
<CommandUIExtension>  
<CommandUIDefinitions>  
<CommandUIDefinition 
 Location="Ribbon.Documents.New.Controls._children"> 
 <Button 
Id="Ribbon.Documents.New.CustomLink" 
Sequence="95" 
Command="Documents.New.OpenCustomLink"
  Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png"
  Image16by16Top="-32" Image16by16Left="-88"
  Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png"
  Image32by32Top="-160" Image32by32Left="-448"
  LabelText="New Group : Custom Link"
  Description="Open Custom Link"
  ToolTipTitle="Custom Action in New Group"
  ToolTipDescription="Opens a Custom Link via a control added to the existing New group on the Ribbon under the Documents tab" 
TemplateAlias="o1" />
  </CommandUIDefinition>
  </CommandUIDefinitions>
  <CommandUIHandlers>
  <CommandUIHandler 
Command="Documents.New.OpenCustomLink"
  CommandAction="http://blog-sharepoint.blogspot.com/"
  />
  </CommandUIHandlers>
  </CommandUIExtension>
  </CustomAction>












CustomAction Registration ID: 101
CustomAction Location: CommandUI.Ribbon
CommandUIDefinition Location: Ribbon.Documents.New.Controls._children




2. Customise the Interface for the Actions Menu and Library Action Groups on the Ribbon
2.1 Add a link to the Actions menu for a Document Library in SharePoint 2010
The CustomAction below is added to the Actions dropdown menu on the toolbar.  Similar to in example 1.1 the Actions menu for Document Libraries is often not displayed by default, so I would recommend adding a control to the relevant group on the Ribbon instead using one of the examples below.  



<!-- Actions Menu : Example 2.1 -->
  <CustomAction Id="Microsoft.SharePoint.StandardMenu.ActionsMenu.CustomLink"
  RegistrationType="List"
  RegistrationId="101"
  GroupId="ActionsMenu" 
Location="Microsoft.SharePoint.StandardMenu"
  Sequence="1101" 
Title="Actions Menu : Custom Link"
  Description="Adds a new Custom Action to the Actions menu for Document Libraries"> 
<UrlAction Url="http://blog-sharepoint.blogspot.com/"/> 
</CustomAction>








CustomAction Registration ID: 101
CustomAction Location: Microsoft.SharePoint.StandardMenu
CustomAction Group ID: ActionsMenu




2.2 Add a Control to the View Format Group on the Ribbon for a Document Library
This will add a new control to the View Format group under the Library tab on the Ribbon when viewing a document library in SharePoint 2010.



<!-- Ribbon - View Format Group : Example 2.2 --> 
<CustomAction Id="Ribbon.Library.ViewFormat.Controls.CustomLink" 
Location="CommandUI.Ribbon"
  RegistrationId="101"
  RegistrationType="List"
  Title="Add to the Existing View Format Group on the Ribbon">
  <CommandUIExtension>
  <CommandUIDefinitions> 
<CommandUIDefinition
  Location="Ribbon.Library.ViewFormat.Controls._children">
  <Button 
Id="Ribbon.Library.ViewFormat.CustomLink"
  Sequence="95" 
Command="Library.ViewFormat.OpenCustomLink" 
Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png"
Image16by16Top="-32" Image16by16Left="-88"
Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png"
Image32by32Top="-160" Image32by32Left="-448"
  LabelText="View Format Group : Custom Link"
  Description="Open Custom Link"
  ToolTipTitle="Custom Action in View Format Group"
  ToolTipDescription="Opens a Custom Link via a control added to the existing View Format group on the Ribbon under the Library tab"
  TemplateAlias="o1" />
  </CommandUIDefinition>
  </CommandUIDefinitions>
  <CommandUIHandlers>
  <CommandUIHandler
  Command="Library.ViewFormat.OpenCustomLink"
  CommandAction="http://blog-sharepoint.blogspot.com/"
  /> 
</CommandUIHandlers>
  </CommandUIExtension> 
</CustomAction>







CustomAction Registration ID: 101
CustomAction Location: CommandUI.Ribbon
CommandUIDefinition Location: Ribbon.Library.ViewFormat.Controls._children




2.3 Add a Control to the “Connect & Export” group on the Ribbon for a Document Library (Document Library Actions)
This adds a new action to the Connect & Export group in the Library Tab for Document Libraries.



<!-- Ribbon - Connect & Export Group : Example 2.3 --> 
<CustomAction Id="Ribbon.Library.Actions.Controls.CustomLink"
  Location="CommandUI.Ribbon" 
RegistrationId="101"
  RegistrationType="List" 
Title="Add to Existing Group">
  <CommandUIExtension>
  <CommandUIDefinitions> 
<CommandUIDefinition
  Location="Ribbon.Library.Actions.Controls._children">
  <Button 
Id="Ribbon.Library.Actions.CustomLink"
  Sequence="95"
  Command="Library.Actions.OpenCustomLink"
  Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png"
  Image16by16Top="-32" Image16by16Left="-88"
  Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png"
  Image32by32Top="-160" Image32by32Left="-448" 
LabelText="Connect &amp; Export Group : Custom Link"
  Description="Open Custom Link"
  ToolTipTitle="Custom Action in Connect &amp; Export Group"
  ToolTipDescription="Opens a Custom Link via a control added to the existing Connect &amp; Export group on the Ribbon in the Library tab"
  TemplateAlias="o1" />
  </CommandUIDefinition>
  </CommandUIDefinitions>
  <CommandUIHandlers>
  <CommandUIHandler 
Command="Library.Actions.OpenCustomLink"
  CommandAction="http://blog-sharepoint.blogspot.com/"
  />
  </CommandUIHandlers>
  </CommandUIExtension>
  </CustomAction>








CustomAction Registration ID: 101
CustomAction Location: CommandUI.Ribbon
CommandUIDefinition Location: Ribbon.Library.Actions.Controls._children



2.4 Customise the Share & Track Group
See example 4.3 for information about the Share & Track Group on the Library tab.  To add or replace a control on this group on the Library Tab the Location attribute of the CommandUIDefinition would be Ribbon.Library.Share.Controls._children.
 

To maintain consistency with the built in commands on the Ribbon, actions in this group should be executed at the Library level and not the item level.  Share & Track Actions for specific items should be included in the Documents -> Share & Track group instead (example 4.3).


CustomAction Registration ID: 101
CustomAction Location: CommandUI.Ribbon

CommandUIDefinition Location: Ribbon.Library.Share.Controls._children

 

3. Customise the Settings Menu and Library Management / Settings Groups on the Ribbon
3.1 Add a link to the Settings Menu for a Document Library in SharePoint 2010
This CustomAction is added to the Settings dropdown menu for Document Libraries.  As explained in examples 1.1 and 2.1, the Settings menu is not always displayed for libraries in SharePoint 2010 as the equivelant functionality (and more) is included in the Ribbon.  The examples below (3.2 and 3.3) can be used to include a custom action as a new control on the Ribbon instead if required.



<!-- Settings Menu : Example 3.1 -->
  <CustomAction Id="Microsoft.SharePoint.StandardMenu.SettingsMenu.CustomLink" 
RegistrationType="List"
  RegistrationId="101"
  GroupId="SettingsMenu"
  Location="Microsoft.SharePoint.StandardMenu" 
Sequence="1101" 
Title="Settings Menu : Custom Link" 
Description="Adds a new Custom Action (link) to the Settings Menu of Document Libraries"> 
<UrlAction Url="http://blog-sharepoint.blogspot.com/"/> 
</CustomAction>





CustomAction Registration ID: 101
CustomAction Location: Microsoft.SharePoint.StandardMenu
CustomAction Group ID: SettingsMenu




3.2 Add A Control to the Customise Library Group on the Ribbon for a Document Library
The example below will include a new control in the existing “Customize Library” group under the Library tab on the Ribbon.



<!-- Ribbon - Customize Library Group : Example 3.2 -->
  <CustomAction Id="Ribbon.Library.CustomizeLibrary.Controls.CustomLink"
  Location="CommandUI.Ribbon"
  RegistrationId="101"
  RegistrationType="List" 
Title="Add to Existing Group">
  <CommandUIExtension> 
<CommandUIDefinitions> 
<CommandUIDefinition
  Location="Ribbon.Library.CustomizeLibrary.Controls._children">
  <Button 
Id="Ribbon.Library.CustomizeLibrary.CustomLink"
  Sequence="95" 
Command="Library.CustomizeLibrary.OpenCustomLink"
  Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png"
  Image16by16Top="-32" Image16by16Left="-88"
  Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png"
  Image32by32Top="-160" Image32by32Left="-448"
  LabelText="Customize Library Group : Custom Link"
  Description="Open Custom Link"
  ToolTipTitle="Custom Action in Customize Library Group"
  ToolTipDescription="Opens a Custom Link via a control added to the existing Customize Library group on the Ribbon in the Library tab"
  TemplateAlias="o1" />
  </CommandUIDefinition>
  </CommandUIDefinitions>
  <CommandUIHandlers>
  <CommandUIHandler 
Command="Library.CustomizeLibrary.OpenCustomLink"
  CommandAction="http://blog-sharepoint.blogspot.com/"
  /> 
</CommandUIHandlers>
  </CommandUIExtension> 
</CustomAction>


 



CustomAction Registration ID: 101
CustomAction Location: CommandUI.Ribbon
CommandUIDefinition Location: Ribbon.Library.CustomizeLibrary.Controls._children




3.3 Add A Control to the Settings Group on the Ribbon for a Document Library
This will add a new control to the Settings group on the Library tab for Document Libraries in SharePoint.



<!-- Ribbon - Settings Group : Example 3.3 --> 
<CustomAction Id="Ribbon.Library.Settings.Controls.CustomLink"
  Location="CommandUI.Ribbon"
  RegistrationId="101"
  RegistrationType="List"
  Title="Add to Existing Group">
  <CommandUIExtension>
  <CommandUIDefinitions>
  <CommandUIDefinition
  Location="Ribbon.Library.Settings.Controls._children">
  <Button
  Id="Ribbon.Library.Settings.CustomLink" 
Sequence="95"
  Command="Library.Settings.OpenCustomLink" 
Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png"
  Image16by16Top="-32" Image16by16Left="-88"
  Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png"
  Image32by32Top="-160" Image32by32Left="-448" 
LabelText="Settings Group : Custom Link"
  Description="Open Custom Link"
ToolTipTitle="Custom Action in Settings Group"
  ToolTipDescription="Opens a Custom Link via a control added to the existing Settings group on the Ribbon under the Library tab"
  TemplateAlias="o1" />
  </CommandUIDefinition>
  </CommandUIDefinitions> 
<CommandUIHandlers> 
<CommandUIHandler 
Command="Library.Settings.OpenCustomLink" 
CommandAction="http://blog-sharepoint.blogspot.com/" 
/> 
</CommandUIHandlers>
  </CommandUIExtension>
  </CustomAction>


 



CustomAction Registration ID: 101
CustomAction Location: CommandUI.Ribbon
CommandUIDefinition Location: Ribbon.Library.Settings.Controls._children



4. Item Level Customisations to the Interface and Ribbon
The examples in this section relate to item level actions executed from the Edit Control Block (item dropdown menu) or from the Ribbon.  The controls added to the Ribbon in the examples below are configured to be enabled only when one or more documents are selected.


4.1 Add a link to the Edit Control Block (item drop-down) menu for a Document
This will add a new link/action to the Edit Control Block (document edit dropdown menu) for documents in a Library.



<!-- EditControlBlock Item Dropdown : Example 4.1 -->
  <CustomAction
  Id="Documents.EditControlBlock.CustomLink"
  RegistrationType="List"
  RegistrationId="101"
  Location="EditControlBlock"
  Sequence="1101"
  Title="EditControlBlock : Custom Link"
  Description="Adds a new Custom Action (link) to the Edit Control Block of Documents in Document Libraries"> <UrlAction Url="http://blog-sharepoint.blogspot.com/"/>
  </CustomAction>








CustomAction Registration ID: 101
CustomAction Location: EditControlBlock



4.2 Add a Control to the “Manage” group on the Ribbon for Documents
This control is included in the Manage group from the Documents tag on the Ribbon, and is enabled when one document is selected from the library on the page.  This is achieved by including an EnabledScript attribute in the CommandUIHandler element, which includes JavaScript that determines if and how many documents have been selected from the list on the page.  The JavaScript returns true to enable the control in the Ribbon, or false to disable the control.  In this case, one document must be selected for the control to be enabled.  If no documents are selected, or more than one document, the control will be disabled.



<!-- Ribbon - Manage Group : Example 4.2 -->
  <CustomAction Id="Ribbon.Documents.Manage.Controls.CustomLink"
  Location="CommandUI.Ribbon"
  RegistrationId="101" 
RegistrationType="List" 
Title="Add to Existing Group">
  <CommandUIExtension> 
<CommandUIDefinitions>
  <CommandUIDefinition
  Location="Ribbon.Documents.Manage.Controls._children">
  <Button
  Id="Ribbon.Documents.Manage.CustomLink"
  Sequence="95"
  Command="Documents.Manage.OpenCustomLink" 
Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png"
  Image16by16Top="-32" Image16by16Left="-88"
  Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png"
  Image32by32Top="-160" Image32by32Left="-448"
  LabelText="Manage Group : Custom Link"
  Description="Open Custom Link"
  ToolTipTitle="Custom Action in Manage Group"
  ToolTipDescription="Opens a Custom Link via a control added to the existing Manage group on the Ribbon in the Documents tab, if a single document is selected on the page." 
TemplateAlias="o1" />
  </CommandUIDefinition>
  </CommandUIDefinitions>
  <CommandUIHandlers>
  <CommandUIHandler
  Command="Documents.Manage.OpenCustomLink"
  CommandAction="http://blog-sharepoint.blogspot.com/"
  EnabledScript="javascript:
function hasDocsSelected(){
var selectedDocuments = SP.ListOperation.Selection.getSelectedItems();
var selectedDocumentCount = CountDictionary(selectedDocuments);
if(selectedDocumentCount == 1)
return true;
else
return false;
};
// Check if documents are selected on the page
hasDocsSelected();
"/>
  </CommandUIHandlers> 
</CommandUIExtension>
  </CustomAction>






CustomAction Registration ID: 101
CustomAction Location: CommandUI.Ribbon
CommandUIDefinition Location: Ribbon.Documents.Manage.Controls._children




4.3 Add a Control to the “Share & Track” (Share) Group on the Ribbon for a Document Library
This will add a new control to the Share & Track group on the Document tab.  The “Share & Track” group is also available from the Library tab on the Ribbon, but has different functionality.  From the Documents tab, one or more Documents generally need be selected before the built in commands are available, which will run on the selected document(s) only.  Controls in the “Share & Track” group on the Library Tab are run on the Library and not specific items/documents.


Similar to example 4.2, the EnabledScript attribute in the CommandUIHandler element that corresponds to this action is used to disable the control if there are no documents selected, or more than one.



<!-- Ribbon - Share & Track Group : Example 4.3 -->
  <CustomAction Id="Ribbon.Documents.Share.Controls.CustomLink"
  Location="CommandUI.Ribbon" 
RegistrationId="101"
  RegistrationType="List" 
Title="Add to Existing Group">
  <CommandUIExtension>
  <CommandUIDefinitions> 
<CommandUIDefinition
  Location="Ribbon.Documents.Share.Controls._children">
  <Button
  Id="Ribbon.Documents.Share.CustomLink"
  Sequence="95"
  Command="Documents.Share.OpenCustomLink" 
Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png"
  Image16by16Top="-32" Image16by16Left="-88"
  Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png"
  Image32by32Top="-160" Image32by32Left="-448" 
LabelText="Share &amp; Track Group : Custom Link"
  Description="Open Custom Link"
  ToolTipTitle="Custom Action in Share &amp; Track Group"
  ToolTipDescription="Opens a Custom Link via a control added to the existing Share &amp; Track group on the Ribbon in the Documents tab, if a single document is selected on the page."
  TemplateAlias="o1" />
  </CommandUIDefinition> 
</CommandUIDefinitions>
  <CommandUIHandlers> 
<CommandUIHandler 
Command="Documents.Share.OpenCustomLink" 
CommandAction="http://blog-sharepoint.blogspot.com/" 
EnabledScript="javascript:
function hasDocsSelected(){
var selectedDocuments = SP.ListOperation.Selection.getSelectedItems();
var selectedDocumentCount = CountDictionary(selectedDocuments);
if(selectedDocumentCount == 1)
return true;
else
return false;
};
// Check if documents are selected on the page
hasDocsSelected();
"/>
  </CommandUIHandlers>
  </CommandUIExtension>
  </CustomAction>






CustomAction Registration ID: 101
CustomAction Location: CommandUI.Ribbon
CommandUIDefinition Location: Ribbon.Documents.Share.Controls._children



4.4 Add a Control to the “Workflows” Group on the Ribbon for a Document Library
This includes a new control in the Workflows group on the Documents tab.  The EnabledScript attribute similar to Examples 4.2 and 4.3 in the CommandUIHandler element is used to disable the control if there are no documents selected.  In this example, the Control will be enabled if one or more documents are selected on the page.  The control will only be disabled when there are no documents selected on the page.



<!-- Ribbon - Workflows Group : Example 4.4 -->
  <CustomAction Id="Ribbon.Documents.Workflow.Controls.CustomLink"
  Location="CommandUI.Ribbon" 
RegistrationId="101" 
RegistrationType="List"
  Title="Add to Existing Group">
  <CommandUIExtension>
  <CommandUIDefinitions> 
<CommandUIDefinition
  Location="Ribbon.Documents.Workflow.Controls._children"> 
<Button Id="Ribbon.Documents.Workflow.CustomLink"
  Sequence="95"
  Command="Documents.Workflow.OpenCustomLink"
  Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png"
  Image16by16Top="-32" Image16by16Left="-88"
  Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png"
  Image32by32Top="-160" Image32by32Left="-448" 
LabelText="Workflows Group : Custom Link"
  Description="Open Custom Link" 
ToolTipTitle="Custom Action in Workflows Group"
  ToolTipDescription="Opens a Custom Link via a control added to the existing Workflows group on the Ribbon in the Documents tab, if a single document is selected on the page."
  TemplateAlias="o1" /> 
</CommandUIDefinition>
  </CommandUIDefinitions>
  <CommandUIHandlers>
  <CommandUIHandler 
Command="Documents.Workflow.OpenCustomLink" 
CommandAction="http://blog-sharepoint.blogspot.com/"
  EnabledScript="javascript:
function hasDocsSelected(){
var selectedDocuments = SP.ListOperation.Selection.getSelectedItems();
var selectedDocumentCount = CountDictionary(selectedDocuments);
if(selectedDocumentCount > 0)
return true;
else
return false;
};
// Check if documents are selected on the page
hasDocsSelected();
"/>
  </CommandUIHandlers>
  </CommandUIExtension>
  </CustomAction>




 


CustomAction Registration ID: 101
CustomAction Location: CommandUI.Ribbon
CommandUIDefinition Location: Ribbon.Documents.Workflow.Controls._children



5. Customise the Document Library Settings Page
5.1 Add a link to the Settings Page for a Document Library in SharePoint 2010
This example includes a new link on the Document Library Settings page.  The Location and Group ID used in this example will add a new custom link under the General Settings heading on the page. 



<!-- Settings Page - General Settings Heading : Example 5.1 -->
  <CustomAction Id="Microsoft.SharePoint.ListEdit.DocumentLibrary.GeneralSettings.CustomLink"
  RegistrationType="List"
  RegistrationId="101"
  GroupId="GeneralSettings"
  Location="Microsoft.SharePoint.ListEdit.DocumentLibrary"
  Sequence="1000"
  Title="Library Settings Page - General Settings : Custom Link"
  Description="Adds a new Custom Action (link) to the General Settings component of the Document Library Settings Page">
  <UrlAction Url="http://blog-sharepoint.blogspot.com/"/> 
</CustomAction>







CustomAction RegistrationId: 101
CustomAction Location: Microsoft.SharePoint.ListEdit.DocumentLibrary
CustomAction Group ID: GeneralSettings


The Group IDs that correspond to other headings on the settings page are below.  The location should be set to Microsoft.SharePoint.ListEdit in each case, but the GroupId attribute is change to one of the following values that correspond to each of the available headings.  Adding a new group/heading and links to the settings page is also possible, but not covered in this tutorial.



GroupIdHeading
GeneralSettingsGeneral Settings
PermissionsPermissions and Management
CommunicationsCommunications



Next Post in the series: Customise the menu and settings page User Interface for built-in List types in SharePoint 2010
In the next post, I will be covering how to customise the interface and Server Ribbon for standard Lists in SharePoint 2010, such as Task lists, Links Lists, Calendars, etc.  The examples will include custom actions for a range of different list types, and will cover adding new controls to groups that differ from the examples in this tutorial.  




References and Related Resources:

Apply Permissions to Custom UI Links / Actions in SharePoint Menus and Settings Pages
This tutorial demonstrates how to restrict custom actions based on user permissions from the SPBasePermissions enumeration in the Rights attribute as well as other properties from the CustomAction class.


Add Custom Links to the SharePoint 2010 UI as a Feature with or without using Visual Studio
This article demonstrates how to implement Custom Actions in SharePoint as a feature:
  • Using Visual Studio (incorporating into a SharePoint project), or
  • Without Visual Studio(manually creating feature XML files and installing using PowerShell or STSADM).
Tutorial: Add Custom List actions using SharePoint Designer 2010
This article demonstrates how to add Custom Actions to lists and libraries using OOB functionality in SharePoint Designer 2010.


List of RegistrationId’s for List Template Types (WSS 3.0, MOSS 2007 and SharePoint 2010)
This article by Mike Smith provides an extensive list of the built-in list templates and corresponding RegistrationIds. Sample code is also included to list the values from the SPListTemplateType enum.


Customizing and Extending the SharePoint 2010 Server Ribbon
This article by Andrew Connell provides a very detailed step by step tutorial for extending the SharePoint 2010 Ribbon using examples.  A download of code for the sample Ribbon customisations is also provided.
Share this article:
Stumble This Delicious
Delicious
submit to reddit
Facebook
MySpace
MySpace

No comments:

Post a Comment