Saturday, October 18, 2008

Adding your own Administration Pages to Site Settings or Central Administration

You can make your custom SharePoint Applications look more like a part of the SharePoint environment by adding any Administration Tasks (ie. settings pages) that you might require into the Admin Console or Site Settings areas.

For this you need a Feature and a definition of the new menu item to be added and where it links to.

<?xml version="1.0" encoding="utf-8"?>
<Feature Id="34251A34-3B03-4149-94A3-A04C5F99E251"
Title="My Administration Link"
Description="Link to administration page."
Version="12.0.0.0"
Scope="Web"
Hidden="FALSE"
DefaultResourceFile="core"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="elements.xml" />
</ElementManifests>
</Feature>

Element.xml file is as below :

<?xml version="1.0" encoding="utf-8"?>
<Elements
xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="ManageMySettings"
GroupId="SiteCollectionAdmin"
Location="Microsoft.SharePoint.SiteSettings"
RequireSiteAdministrator="TRUE"
Sequence="45"
Title="Manage My Settings">
<UrlAction
Url="_layouts/MyAppSettings.aspx" />
</CustomAction>
</Elements>

This elements.xml file adds a link to the Site Settings Page (by setting the Location attribute), under the Site Collection Admin area (specified by the Group ID) and requiring Site Administrator Access to get to. The UrlAction element specifies where the link goes (in this case to an aspx page in _layouts).

I can also insert links into the Central Admin area if needed just by specifying a different CustomAction:

<?xml version="1.0" encoding="utf-8"?>
<Elements
xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomActionGroup
Id="Mine"
Location="Microsoft.SharePoint.Administration.ApplicationManagement"
Title="My Applications"
Sequence="100" />
<CustomAction
Id="MyAppSettings"
GroupId="Mine"
Location="Microsoft.SharePoint.Administration.ApplicationManagement"
Sequence="11"
Title="My App Settings">
<UrlAction
Url="/_admin/AppSettings.aspx" />
</CustomAction>
</Elements>