Few weeks ago we were talking about how we can create an option into the section “Site Administration” on the site settings configuration, Custom setting section in site settings WSS 3.0 and MOSS 2007. In the image 1 we can see this option created into the Site Administration section.
[Image 1]
Now, we are going to create a custom group section in the site settings configuration as we can see in the image 2.
The source code that we will use in this article is the same used in the previous post. We need change the feature used to install our options then we are going to add a new node named CustomActionGroup in the xml file named elements.xml. In the section 1 we can see the source code used.
[Section 1]
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"><CustomActionGroupId="DF784448-CD3F-4221-9B8A-69769FA961EE"Title="Custom Group Setting"Location="Microsoft.SharePoint.SiteSettings"Sequence="110"></CustomActionGroup><CustomActionId="EDBEB420-A817-4896-BE42-F5B9048C0CF5"Title="Configuracion 1"Location="Microsoft.SharePoint.SiteSettings"GroupId="DF784448-CD3F-4221-9B8A-69769FA961EE"Sequence="120"RequireSiteAdministrator="FALSE"><UrlAction Url="_layouts/HelloWordSiteSettings.aspx"/></CustomAction><CustomActionId="29020219-0C09-4ef0-BF0A-8921F99AD1B0"Title="Configuracion 2"Location="Microsoft.SharePoint.SiteSettings"GroupId="DF784448-CD3F-4221-9B8A-69769FA961EE"Sequence="130"RequireSiteAdministrator="FALSE"><UrlAction Url="_layouts/HelloWordSiteSettings.aspx"/></CustomAction></Elements>The only change that we will do is in the node CustomAction. In the attribute GroupId we must set the id of our CustomActionGroup. With this, we are creating a relation between both nodes. For this example we configured the CustomAction node as we can see in the following table:
- ID -> A new guide.
- Title-> The name of the option that we want show.
- Location-> In which section of sharepoint we want show this option.
- GroupId-> The id of our CustomActionGroup.
- RequireSiteAdministrator-> We set FALSE
- Sequence-> The order that we want show the option into the our group
- UrlAction-> We don’t change this option.
In the following table we can see the configuration for the node CustomActionGroup:
- Id-> A new guide.
- Title-> The name of the option that we want show.
- Location-> In which section of sharepoint we want show this option.
- Sequence-> The id of our CustomActionGroup
Now we are going to create our WSP to install the solution in our Sharepoint using the option in the Visual Studio 2008. In the image 3 we can see the output windows showing the status of the building of our WSP.
[Image 3]
Once the WPS was created we are going to install the solution using a bat file. In the section 2 we can see the source code of the file “InstallSolution.bat” that we should use.
[Section 2]
@echo off
set URL=http://<Servidor>/
set STSADM="C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12BINstsadm.exe"
set SOLUTION_NAME=WspAddSectionWebSettings.wsp
set FEATURE_NAME=AddSectionToSiteSettings
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
iisreset
rem ***********************************************
echo *
echo * Activating feature… ‘%FEATURE_NAME1%’ in ‘%URL%’
echo *
%STSADM% -o activatefeature -name %FEATURE_NAME% -url %URL% -force
echo *
echo * Install Completed.
echo *
To uninstall the solution we can use a file “unistallSolution.bat”. You can download the complete source code from the following URL:
