Customise SharePoint 2010 “Site actions” menu
27 February 2011
The Site Actions menu is available on every page inside of SharePoint Foundation. You can add an additional item to this menu using the following custom action. Let’s start J
1. Create an empty SharePoint project in visual studio 2010
2. Now Double-click Feature1 under feature section of project and update the properties, make sure you change the scope to “Web Application“
3. Now you need to create an element to attach to your feature, to do that right-click on the project and add a new item, then choose “Empty Element“. Give it a proper name.
Now edit your element file to reflect what you needed (The additional menu item on the site action drop down menu), here is a sample code to create a “Custom Settings” link which goes to a page in SharePoint called “/SitePages/CustomSettings.aspx”
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <CustomAction Id="SiteActionsToolbar" GroupId="SiteActions" Location="Microsoft.SharePoint.StandardMenu" Sequence="1000" Title="Custom Settings" Description="Custom site settings" ImageUrl="_layouts/ebloginImages/logo.png"> <UrlAction Url="/SitePages/CustomSettings.aspx"/> </CustomAction> </Elements>
4. Once you edit the element file, all you need to do now is to package it. Right click on the Project or on the Menu bar Choose Build->Package.
5. Copy your packaged file (.wsp) to SharePoint server and install it using stsadm or PowerShell.
Your site action menu will have a new option as shown in below picture.