I have been working with SharePoint 2010 for about 9 months now across 5 different projects and I have been asked on a number of occasions how can we stop users of an Intranet from seeing the ‘View All Site Content’ links that appear. Only now on my current project have I had the time to really look at this and tidy up the user experience.
Basically read only users when they access a site will only have displayed to them the folder icon to aid navigation. But when they access a list or library within that site even read only users get offered the Site Actions dropdown. This can be good because when they have Office 2010 with the SharePoint Workspace tool installed they are given the option of synchronising that list or library for offline usage. But rather annoyingly they also get the ‘View All Site Content’ displayed and from this users are able to browse all libraries and lists they have read access.
The other place this can appear is in the left navigation under the configurable links by the Recycle bin. Now of course read only users can’t see the Recycle bin but will see the View All Site Content.
To resolve this we need to update our site Master Page and security trim the links and options. Now the page we call on View all site Content is “layouts/viewlsts.aspx” so the line we are looking for is “~site/_layouts/viewlsts.aspx”.
This is embedded in a section we want to security trim which can be seen in white and the lines in red either side of this section are to remove it from standard users.
<SharePoint:SPSecurityTrimmedControl ID=”SPSecurityTrimmedControlName″ PermissionsString=”ManageWeb” runat=”server”>
<SharePoint:MenuItemTemplate runat="server id="MenuItem_ViewAllSiteContents"
Text="<%$Resources:wss,quiklnch_allcontent%>"
Description="<%$Resources:wss,siteactions_allcontentdescription%>" ImageUrl="/_layouts/images/allcontent32.png" MenuGroupId="300" Sequence="302" UseShortId="true" ClientOnClickNavigateUrl="~site/_layouts/viewlsts.aspx" PermissionsString="ViewFormPages" PermissionMode="Any"
/>
</SharePoint:SPSecurityTrimmedControl>
In my example I have used the ManageWeb permission level but there are a number of other levels we can use to allow lower privileged users access to this option. This Microsoft MSDN article outlines some other options.
The other area we want to control is on the left navigation by the Recycle bin so use this code to do the same.
<SharePoint:SPSecurityTrimmedControl ID=”SPSecurityTrimmedControlName″ PermissionsString=”ManageWeb” runat=”server”>
<li>
<SharePoint:ClusteredSPLinkButton id="idNavLinkViewAllV4"runat="server"
PermissionsString="ViewFormPages"
NavigateUrl="~site/_layouts/viewlsts.aspx"
ImageClass="s4-specialNavIcon"
ImageUrl="/_layouts/images/fgimg.png"
ImageWidth=16
ImageHeight=16
OffsetX=0
OffsetY=0
Text="<%$Resources:wss,quiklnch_allcontent_short%>"
accesskey="<%$Resources:wss,quiklnch_allcontent_AK%>"/>
</li>
</SharePoint:SPSecurityTrimmedControl>
Once this is done we should then be able to control who sees the View all Site Content link. This makes our user experience for standard read only and contribute users a lot nicer and cleaner.
Good stuff, worked perfectly.
ReplyDelete*After I replaced the quotation marks with real ones so that the class names would resolve, in SPD2010.
It’s a very informative and helpful article, thank you for sharing!
ReplyDelete