10

I am in a need to hide the Site Content option completely from site for Visitors. Can anyone help me how I can achieve this goal?

How to hide Site Content only for Visitors or a particular security group in SharePoint 2013?

3
  • same issue here, but in SPO Teams Site, the external user (created in my domain account but without licences) he can see the Team Group Members. :( .... is not GDPR OK because my user have phone nr. etc on there profile. :(((
    – Petrix
    Commented Dec 17, 2018 at 16:08
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
    – MHeld
    Commented Dec 17, 2018 at 17:54
  • How do I hide site contents for visitors but still allow them to complete the InfoPath form published on the same page? Commented Oct 1, 2019 at 11:43

5 Answers 5

20

You have two possibilities in this case that doesn't require code.

Variant 1) Change the permission level of visitor When you change the permission level from "Read" to "Restricted Read" your user won't see the site contents anymore

Variant 2) Alternate read permission level of visitors You can simply remove the base permission "View Application Pages" from the "Read" Permission level.

The "site contents" is not the only place where user will see this navigation option. It is also available through the gear icon on the suite bar. By changing the permissions or permission level it will be hidden from there too.

1
  • 2
    That's what I needed. Particularly the second choice worked. I created custom permission level similar to Read and removed "View Application Page" . Option is restricting users to run JQuery. Commented Dec 9, 2015 at 8:40
6

You'd have to remove it from 2 places, the Quick Launch and the Site Actions menu. You can use JQuery and SPServices to check group membership and hide the link in the Quick Launch. Put the code in your master page(s), not a Content Editor Web Part, to hide it on the entire site. You can also use JQuery to hide "View All Site Content" from the Site Actions menu.

However, you will not be able to prevent users from typing /_layouts/viewlsts.aspx directly into the address bar. Clicking the default "Lists" or "Libraries" headers in the Quick Launch would also take them to the content page. It might be possible to add JQuery to the system master page to redirect visitors to a different page if the URL includes /_layouts/viewlsts.aspx.

1
  • Create a separate SharePoint Group (or Audience in Central Admin)
  • Check Group Membership with:
  • CEWP (on every needed page); (audience) targeted to this group
  • or with Code in your MasterPage
  • Apply CSS to alter UI
  • inside CEWP
  • append CSS from MasterPage

Usually your visitors won't go to many pages, so the CEWP option works fine.

Note: If they know the URL they can go where they have rights

So it is kind of pointless to hide it; they should only see what they are allowed to see inside "Site Contents"

0

What you do usually when you have an internet publishing site is to include a SPSecurityTrimmedControl on your masterpage, to restrict the real visibility of the control (here the quicklaunch) for different users.

An other solution is to restrict the link directly on the link itself. When you see the control in the masterpage, you have properties like PermissionsString="ViewFormPages".

The control for the link in the masterpage (seattle.master)

<SharePoint:ClusteredSPLinkButton
                            runat="server"
                            id="idNavLinkViewAll"
                            PermissionsString="ViewFormPages"
                            NavigateUrl="~site/_layouts/15/viewlsts.aspx"
                            Text="<%$Resources:wss,AllSiteContentMore%>"
                            accesskey="<%$Resources:wss,quiklnch_allcontent_AK%>"
                            CssClass="ms-core-listMenu-item ms-core-listMenu-heading" />

You can change the permissionstring to "ManageWeb" to restrict the link to the admin.

For both solution, you should update the masterpage, with SP Designer e.g

Regards,

ps : Don't forget to NOT update standard masterpage but make a copy before and work on this copy :)

3
  • I just wanted to hide it from Visitors. Rest users who have contribute permission should be able to see the Site content Option. Commented Dec 4, 2015 at 11:19
  • You can choose the appropriate permission for your site and who will see the Site content option. I said ManageWeb because it's the common one. But there are other options. See here : social.msdn.microsoft.com/Forums/sharepoint/en-US/… Commented Dec 4, 2015 at 13:36
  • You'll still need to find a way to hide the Site Actions option.
    – Erin L
    Commented Dec 5, 2015 at 15:49
0

SharePoint Online doesn't handle the permissions at the same way as SharePoint 2013.

Use this:

<SharePoint:SPSecurityTrimmedControl runat="server" Permissions="AddListItems" 
    PermissionContext="CurrentItem" PermissionMode="Any">
    <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=43"
        MenuGroupId="200"
        Sequence="240"
        UseShortId="true"
        ClientOnClickNavigateUrl="~siteLayouts/viewlsts.aspx"
        PermissionsString="ViewFormPages"
        PermissionMode="Any" />
</SharePoint:SPSecurityTrimmedControl>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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