Hide Links in a SharePoint Tree View Control

I was taking a look at a SharePoint 2016 Web site and one of the requirements was to have a document library containing a folder hierarchy and then to have the left hand menu bar on the site to allow navigation of the folder structure. In SharePoint the best way to accomplish this sort of navigation is to use the Tree View control. This control continues to be used in later versions of SharePoint and shares the same quirks, one of which is that it isn’t very customizable.

  • As a side note, the Tree View control appears on the left hand menu bar and has the title: Site Content. You can add the Tree View to your site by checking the checkbox under Site Settings -> Look and Feel

A problem with the SharePoint Tree View control is that it cannot easily be customized. It will show pretty much everything on the site including Site Pages and Site Assets as well as other custom libraries.

You probably don’t want to expose the more admin-related controls like Site Assets and Pages to your regular users. You can update the security to deny access to regular users, but this doesn’t remove the links to them from the Tree View control. Instead users see the links even if they don’t have access and then get an access denied message when they click the link.

Solution

The only way that I’ve found to remove unwanted links from the Tree View control is to this in SharePoint Designer. Specifically, open your site in Designer and select the list you want to hide. Then check the checkbox to Hide from Browser.

This will remove the link to the list from the Tree View control. The problem is that this is a blanket ‘Hide’ that will remove the link, but also make the control hidden elsewhere on the site such as in Site Contents. You’ll want access at some time to areas such as Site Assets and Site Pages so it’s not so great if they are hidden from view.

To deal with hidden functions an easy and quick solution is to create an ‘admin‘ list that links to the important admin sections of the site. Basically create a new links list on you site and then add each link that you will hide. That way you’ll still have access to the hidden links even though they are hidden throughout the site. A point to note is that this new links list will show up under the Tree View control so you should give it a descriptive name.

Summing up

The steps are:

  1. Create a new list on your site and link to to the controls that you are about to hide
  2. Open your site in Designer and check ‘Hide from Browser’ for the controls to hide

I found a discussion about this problem on Stack Exchange here:

https://sharepoint.stackexchange.com/questions/59774/hide-some-lists-from-treeview

Leave a comment