Thursday, March 19, 2009

Creating MenuItem in the site Actions menu and adding Security

The application pages and supporting menu items in the Site Actions menu shown so far have been created in a manner so that they are accessible to all users of a site. However, that isn't always desirable. Application pages are often designed to provide information and functionality that should only be accessible to site administrators. The same shows to create a menu item in the Site Actions menu.

This can be installed to sharePoint as a feature as mentioned in the XML below. You can add an attribute named RequireSiteAdministrator and assign it a value of true so that the menu item only displays to those users who are also site administrators.

< CustomAction Id="SiteActionsToolbar" GroupId="SiteActions" Location="Microsoft.SharePoint.StandardMenu" Sequence="1003" Title="Application Page 3" Description="Check out some typical site properties" RequireSiteAdministrator="True" ImageUrl="/_layouts/images/DECISION.GIF">
< UrlAction url="~site/_layouts/CustomApplicationPages/ApplicationPage3.aspx">
< /CustomAction>

After Installing the feature, the SharePoint site looks like

No comments: