Share this page

Monday, November 16, 2009

How to add a new option in the Site Actions menu of SharePoint 2007

In this article we are going to review how can create a new option in the Site Actions menu of the SharePoint 2007. The option that we are going to create is a lite Site Map that is showing the sites created in the site where we are and a link to return of the parent site as we can see in Image 1. To create this project I’m using the last version of WSPBuilder from Codeplex.

[Image 1]
1_SiteMap

The first task that we need to do is create a new project using the template installed by WSPBuilder installer. Once the project was created we must add a new item to the project using other template. This option must be a blank feature then we are going to find a BlankFeature template in the templates available to create our feature. The project in Visual Studio 2008 should be as we can see in Image 2

[Image 2]
2_Proyecto

The next step is to create a class (SiteActionSiteMap) in the root of the project as we can see in the image 2. This class must inherit from the WebControl class of Asp.Net because we are creating a custom control to add the options.
The last step is adding a CustomAction node in the XML element.xml to set our custom action for the Site Actions. In section 1 we can see the source code for the element.xml.

[Section 1]

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
    Id="CustomSiteActionOptionMenu"
    GroupId="SiteActions"
    Location="Microsoft.SharePoint.StandardMenu"
    ControlAssembly ="Sierys.Blog.Navegation.SiteAction,Version=1.0.0.0, Culture=neutral, PublicKeyToken=711eed342842acee"    ControlClass="Sierys.Blog.Navegation.SiteAction.SiteActionSiteMap">
    <UrlAction Url="/_layouts/SpUsageSite.aspx"/>
  </CustomAction>  
</Elements>

Once the package was installed and the feature was activated we can see our custom option in the Site Actions menu. Remember you need permission to access at this menu.

Download Source Control
3_Skydrive

Fabián Imaz

No comments: