cd ../blog

Adding a Page to Central Admin of SharePoint 2010

Step-by-step guide to adding a custom navigation node and application page to SharePoint 2010 Central Administration using a farm solution in Visual Studio 2010.

</>

Hey everyone!

I’m going to put this post into 2 sections. First: how to add a navigation node to Central Admin of SharePoint 2010.

The site below is a great source of information. It doesn’t contain info on how to create your own custom section in CA, but it shows where to add items to existing sections (like the Timer Job section):

http://bloggingabout.net/blogs/arjen/archive/2010/02/04/custom-action-definitions-in-sharepoint-2010.aspx

Here’s a step-by-step hello world — using Visual Studio 2010.

Step 1: Create the Project

  • Create a new project → SharePoint 2010 → Empty SharePoint Project (name it CAHelloWorld)
  • Enter the Central Admin URL and select Deploy as farm solution

Step 2: Add the Admin Mapped Folder

  • Right-click project → Add → Add SharePoint Mapped Folder → select Template\admin
  • Create a new subfolder inside it named HelloWorld

Step 3: Add the Application Page

  • Add a new item to the HelloWorld folder: SharePoint 2010 → Application Page, name it HelloWorldPage.aspx
  • Replace the page content with:
<%@ Assembly Name="Microsoft.SharePoint.ApplicationPages.Administration, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/_admin/admin.master" %>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    Hello Guys
</asp:Content>
<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
    Application Page
</asp:Content>
<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server">
    My Application Page
</asp:Content>
  • Drag the .aspx from the layouts dir to the HelloWorld folder. Delete the code-behind and the created mapped layouts directory.

Step 4: Add the SiteMap File

Below the mapped Admin directory, add an XML file. The name must start with admin.sitemap. — for example admin.sitemap.Hello.xml.

Content:

<siteMap enableLocalization="true">
    <siteMapNode parentUrl="/_admin/server.aspx"
                 url="/_admin/HelloWorld/HelloWorldPage.aspx"
                 title="Hello to the world" />
</siteMap>

Step 5: Add an Elements File

Add an empty elements file (Add Item → SharePoint 2010 → Empty Element, name it HelloElement).

This is where the link from Arjen’s blog comes in — the GroupId and Location attributes map to the CA sections.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
    Id="Testing.HelloWorld"
    GroupId="TimerJobs"
    Location="Microsoft.SharePoint.Administration.Monitoring"
    Sequence="6"
    Title="HelloWorld"
    UIVersion="4">
    <UrlAction Url="/_admin/HelloWorld/HelloWorldPage.aspx"/>
  </CustomAction>
</Elements>

Step 6 & 7: Set Scope and Deploy

  • Change the feature scope from Web to Farm
  • Right-click solution → Build → Package → Deploy

A node should now appear in the Timer Jobs section of Central Admin, pointing to your page.


My next post will be a conversion of the Job Definition Configurator tool from Karine Bosch to SharePoint 2010. Stay tuned! 😊