Monday, July 1, 2013

Add a Link to Site Settings Page in SharePoint 2010

There was a requirement to get list owners info who created the lists, we developed a custom application page in SharePoint 2010: How to Create Custom Application Page in SharePoint 2010 to get List Owners

But the link to the application page to be placed somewhere in the site for an easy access by site owners, isn't it? Where to link it? Site settings page would be the ideal place for such things! So lets add a link to site settings page in SharePoint 2010.

SharePoint 2010 add link to site settings page
1. Create a new "Empty SharePoint Project" Farm Solution in Visual Studio 2010. Give it a Name.

add link to site settings page sharepoint 2010

2. Add an Empty Element to the Project. This will add "Elements.xml" file to the solution.
add link to site settings sharepoint

3.  Update the Elements.xml file with the below code: This adds group to site settings as well as add link in site settings page in that group.

  <!-- Add a Custom Group "Site Owner Reports" under Site Actions -->
    <CustomActionGroup Description="Group for Site Owner Reports" Id="Crescent.SiteOwnerReports"
       ImageUrl="/_layouts/images/crescent-rpt-48.png" Location="Microsoft.SharePoint.SiteSettings"
  Sequence="100" Title="Site Owner Reports">
  </CustomActionGroup>

  <!-- Add a Link under the Group "Site Owner Reports" in Site Actions -->
    <CustomAction GroupId="Crescent.SiteOwnerReports" Id="UserInterfaceCustomActions.SiteSettings" 
   Location="Microsoft.SharePoint.SiteSettings" Sequence="20" Title="List Owners Info">
       <UrlAction Url="~site/_layouts/CrescentReports/ListOwners.aspx" />
  </CustomAction>
Now the Elements.xml file should look like:
sharepoint 2010 add custom site settings
4. Add an Icon image to mapped "Images" folder. This image will display in site settings links group.

5. Rename the Feature Title and Description through Feature Designer.
sharepoint 2010 add group to site settings

 6. Deploy the Project. Tha's all, We have added link to site settings page in SharePoint 2010. See the result in action:
sharepoint 2010 add link to site settings page
Location & ID parameters are the key in above Elements.xml to add link to site settings page in SharePoint 2010. They defines where the custom group or link should appear. You can place a link to any existing group by supplying its GroupID value.
  • E.g. To add a link under Site collection Administration group of site settings, Provide the Group ID as "SiteCollectionAdmin"
  • To add a link to site settings under "Look and Feel", the Group ID goes like "Customization"
If you want to add a custom group and link in SharePoint 2007, Refer: Add a Link to Site Settings Page in SharePoint 2010. For all available Locations, Refer MSDN: Default Custom Action Locations and IDs



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

2 comments :

  1. Hi Salaudeen Rajack,

    Thank you for a nice and informative post!

    How can i make this custom action appear only for "Site Collection Administrators"? I tried using "RequireSiteAdminstrator" attribute but it ended up showing the action to all users who has "Full Control" permissions on the site.

    Also, How can i make this action available only in Root Site collection instead of subsite's site settings page?

    Thanks,
    Sudheer.

    ReplyDelete
    Replies
    1. Hi Sudheer,

      You can set the GroupId of your custom action to SiteCollectionAdmin So that it shows up in the Site Collection Admin group and will only show up on the Root site collection. Usually we use 'Rights' attribute to apply security trimming on CustomAction. If you Feature scope is Site, Set RootWebOnly="TRUE" to deploy it only to root site.

      Delete

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...