Wednesday, April 8, 2015

Hide menu items in a SharePoint site

An interesting question today on technet forum on how we can avoid display of site contents menu in a SharePoint site for users with just read permissions.



My initial reaction was to use security trimming around this control but then there are more options targeted specifically to menu item controls.

So here are the steps

1. Open up the default master page in SharePoint designer. (How to identify default master page is a very dirty tweak but does work).

2. Navigate to the section where SharePoint:MenuItemTemplate are available (right after wssuc:Welcome control usually)

you will find this:





3. The permissingstrings property is the key - choose the permission string for which you want to enable this menu. I changed it to Add and edit list items permissions

  <SharePoint:MenuItemTemplate runat="server" id="MenuItem_ViewAllSiteContents"
 Text="<%$Resources:wss,quiklnch_allcontent_15%>"
 Description="<%$Resources:wss,siteactions_allcontentdescription%>"
 ImageUrl="/_layouts/15/images/allcontent32.png?rev=23"
 MenuGroupId="200"
 Sequence="240"
 UseShortId="true"
 ClientOnClickNavigateUrl="~siteLayouts/viewlsts.aspx"
 PermissionsString="AddListItems, EditListItems"
 PermissionMode="Any" />


4. Save the master page and reload the site collection


Now to have a good idea of all permissionstrings  that are possible, see this entry

No comments: