Share this page

Saturday, May 16, 2009

Custom configuration section on the central administration of SharePoint 2007

In the last article published we were talking about how we can create a custom configuration section in the site setting Custom group section in site settings - WSS 3.0 y MOSS 2007, in the image 1 we can see this section created.

[Image 1]

In this article we are going to talk about how we will create a custom configuration section in the central administration of MOSS 2007 (Microsoft Office Sharepoint Server) and WSS 3.0 (Windows Sharepoint Services). The section will be in the Application Management tab of the Central Administration but we to create a custom section in other tab of Sharepoint, for example in Operation tab, the only thing that we need to do this is change the attribute location in the elements node and the base class of our custom page to inherits from OperationsPage, in the namespace Microsoft.SharePoint.ApplicationPages into the assembly Microsoft.SharePoint.ApplicationPages.Administration.dll
We are going to create a feature to create our custom section and install the page or pages with our code. The feature will be installed in the portal web where the central administration is running. In the image 2 we can see the feature activated in the portal web.

[Image 2]

Ok, let go to develop our custom configuration. The first thing that we are going to do is create a feature. I’m using Visual Studio 2008 and WSPBuilder templates. Once the feature was created we are going to change the elements.xml file to add our configuration into the node elements. In the section 1 we can see the complete source code to define our custom section and 2 options configurations.

[Section 1]

<Elements xmlns="">
  Title="Custom Administration Setting"
  Title="Configuracion 1"
    <UrlAction Url="_admin/Siderys/CustomAdminSettings.aspx"/>
  Title="Configuracion 2"
    <UrlAction Url="_admin/Siderys/CustomAdminSettings.aspx"/>

The first node that we need create is CustomActionGroup, this node defines our custom section and in the following table we can see the attributes that we need set.

· Id = A unique guid.

· Title = text that will be show.

· Location = section where we want create our custom section.

· Sequence = Numeric value.

The other 2 nodes will be CustomAction node and represent our configuration options. We can to more CustomAction node depending of the how many sections needed. In the following table we can see the attributes that we need set.

· Id = a unique guid.

· Title = text that will be show.

· Location = section where we want create our custom section.

· GroupId = If of the group section where we want show our custom configuration options. In this case we will add the id of our custom section

· RequireSiteAdministrator = If this option only can see by site administration then will be true if not false.

· UrlAction = Node inside the CustomAction node where we define the URL to the page.

Now we are going to create our custom configuration page. This page must inherit from ApplicationsManagementPage in the namespace Microsoft.SharePoint.ApplicationPages inside in the assembly Microsoft.SharePoint.ApplicationPages.Administration.dll. Our page will be installed in the admin folder (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\ADMIN) because all page used in the central administration must be here. The path loaded in the attribute URL of the node UrlAction must start with _admin because this application in the IIS is mapped to the path C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\ADMIN where all pages and component to run the central administration were installed by Sharepoint.

In the image 3 we can see our custom section configuration in the central administration.

[Image 3]


In the image 4 we can see our custom page loaded when the user selected one of the options created in our custom section.

[Image 4]


Now we need compile the solution and to create the WSP package to install in Sharepoint. Remember that if we are using a WSPBuilder solution to create our project and feature. In the section 2 we can see the source code to create a batch installation file to add the WSP to sharepoint and active the feature. The only change that we must do is the variable URL and add the URL of our central administration.

[Section 2]

@echo off

set URL=http://<Servidor>/

set STSADM="C:\Program Files\Common Files\

Microsoft Shared\Web Server Extensions\12\BIN\stsadm.exe"

set SOLUTION_NAME= WspAddGroupSectionAdminSettings.wsp

set FEATURE_NAME= AddGroupAdminSetting

echo *

echo * Installing solution... '%SOLUTION_NAME%'

echo *

%STSADM% -o addsolution -filename %SOLUTION_NAME%

echo *

echo * Activating solution ... '%SOLUTION_NAME%'in %URL%

echo *

%STSADM% -o deploysolution -name %SOLUTION_NAME%

-url %URL% -immediate -allowGacDeployment -force

%STSADM% -o execadmsvcjobs


rem ***********************************************

echo *

echo * Activating feature... '%FEATURE_NAME1%' in '%URL%'

echo *

%STSADM% -o activatefeature -name %FEATURE_NAME% -url

%URL% -force

echo *

echo * Install Completed.

echo *

You can download the complete source code form my SkyDrive.


Descargar Solución Completa con Instalador

Fabián Imaz

No comments: