2

I've a site, and visitors (logged) are seeing the menu option "Site content" when in a list page.

Menu item

I already looked this question "Hiding SharePoint 2013 ribon and Site Contents page for anonymous users", but my test user are logged and have only read permission, how hide this option to him?

2

Use SharePoint:SPSecurityTrimmedControl with PermissionsString="FullMask". Then only users with full control or site collection administrators will be able to see the Gear icon for site actions, but this will hide all site actions menu .

<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl1" PermissionsString="FullMask" runat="server">
    <SharePoint:SiteActions>..</SharePoint:SiteActions>
</SharePoint:SPSecurityTrimmedControl>

If you only want to hide Site Contents link from the Site Actions menu, try following.

<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="FullMask"
    PermissionMode="Any" />

By default the PermissionsString property has value ViewFormPages, which allows read users also to see this link.

You can change it to a different permission level (eg: I have changed it to FullMask in above code so that only admins will see it). You can find list of permissions in the MSDN article for SPBasePermissions enumeration.

  • 1
    If i want to use it, then where should I place this control. In master page should I wrap some existing with this? A small example would be helpful – Asad Refai Jun 30 '15 at 23:12
  • 1
    Yes, in the master page, you find the markup responsible for the Site Contents, and you wrap in in that control and it will trim to only those with full control (in the provided example). – Eric Alexander Jul 1 '15 at 1:39
  • Edited my answer, you can place <SharePoint:SiteActions> inside security trimmed control or try the other approach if you only want to hide site contents link. – Unnie Jul 1 '15 at 7:56
  • Are you using custom mastrepage or Seattle masterpage? – Unnie Jul 1 '15 at 12:44
  • 1
    I solved this, the attribute PermissionsString="FullMask" doesn't works, but SharePoint:SPSecurityTrimmedControl is. – Carlos Jul 1 '15 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.