Adding Links to Site Settings

In part 1 I covered Adding Links to Central Administration but now it’s time to take a look at how I added links to the site settings screen for my CodePlex creation SharePoint 2010 Site Styles. Note that the process is almost identical.

So the final goal is something that looks like this:

Just like part 1 this solution uses feature activation (no code required) to make this happen. Here we go!

The Feature XML

Your feature XML will look something like this (Here’s the actual code from SharePoint Site Styles:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
 
  <CustomAction
    Id="SiteStyle"
    GroupId="Customization"
    Location="Microsoft.SharePoint.SiteSettings"
    Title="Site style"
    Rights="ApplyThemeAndBorder"
    Sequence="41">
    <UrlAction Url="_layouts/CP.SharePoint.SiteStyles/styleweb.aspx"/>
  </CustomAction>        
 
</Elements>

Custom Action

Again I’m only covering a few things that I think are important and not covered in the CustomAction MSDN article.

GroupId Should reference the Id in your CustomGroupAction or one of the existing CustomActionGroups already implemented in SharePoint. Check the full list of locations on MSDN.

  • Customization
  • Galleries
  • SiteAdministration
  • SiteCollectionAdmin
  • UsersAndPermissions
Location Identifies where with SharePoint this link will appear. Be sure to read through the full list of locations on MSDN. The target location for site settings is: Microsoft.SharePoint.SiteSettings
Title The display title of the link that will be displayed in your target location / group.
Rights Used for security trimming of the link in the site actions menu. In this case I used ApplyThemeAndBorder so that the security of applying a site style is the exact same security that is required to apply a site theme. You can find the full list of security strings on the SPBasePermissions MSDN article.
Sequence What’s important to note here is that the out of the box links go in increments of 10’s so if you are trying to stick a link between two existing links then try smaller increments. Microsoft installs the out of the box links using the following file “14\TEMPLATE\FEATURES\AdminLinks\Applications.xml”.
UrlAction The URL to the actual link. Note: This can include inline JavaScript which can be very helpful in some cases. Consider making this relative so that it will work in any sub site and not always redirect users back to the web application root.
I'm a public speaker and the Chief SharePoint Architect for Eastridge, a Microsoft Gold Partner specializing in SharePoint and custom application development in Winston-Salem, NC. I focus on the SharePoint platform with a specialty in Information Architecture, Publishing and Best Practices.

Got something to say? Go for it!