How to Hide a List or Library in SharePoint?

Requirement: Hide a SharePoint list or library from the browser
But why? Because, My custom application uses some configurations that should be stored and retrieved from a SharePoint list, but it must not be visible to end-users to avoid any mess. So, we have to hide our configuration list from users.

We don’t want the configuration list to be available to users, but visible only for the custom application code to read/write in it.  So let us hide the configuration lists from the “View All Site Content” page.

How to Hide a List in SharePoint?

To hide a SharePoint 2007 or SharePoint 2010 list or library, we either use SharePoint API (Set SPList.Hidden property of the SharePoint list programmatically with either C# Object Model code or PowerShell) or use SharePoint Designer.

Even SharePoint itself uses lots of hidden Lists & Libraries for its own operations (E.g., “Content and Structure Reports”, “Master Page Gallery”, “Form Templates”, “User Information List”, etc.)

To hide a list in SharePoint using PowerShell:
To hide a library in SharePoint, use the below PowerShell script.

#Define the Web URL & List Name
$WebUrl = "https://sharepoint.crescent.com/sites/Sales"
$ListToHide = "AppConfig"

#Get the Web
$web = Get-SPWeb $WebUrl
#Get the List
$list = $web.Lists[$ListToHide]

#Set the Hidden Property
$list.Hidden = $true
$list.Update()

#Displose Web Object
$web.Dispose()

Hide SharePoint List using CSOM-PowerShell:

#Load SharePoint CSOM Assemblies
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime") | Out-Null

#Variables for Processing
$SiteUrl = "https://portal.crescent.com/sites/sales"
$LibraryName="Team Docs"
 
#Setup Credentials to connect
$Credentials = [System.Net.CredentialCache]::DefaultCredentials

#Set up the context
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl) 
$Context.Credentials = $credentials

#Get the List and Make it hidden
$list = $Context.Web.Lists.GetByTitle($LibraryName)
$list.Hidden = $true
$list.Update()
$Context.ExecuteQuery()

Hide a Document Library in SharePoint using C# Object Model Code:

using (SPSite site = new SPSite("https://sharepoint.crescent.com/sites/Sales"))
{
    using (SPWeb web = site.OpenWeb())
    {
       SPList configList = web.Lists["AppConfig"];
       configList.Hidden = true;
       configList.Update();
    }
}

This method of hiding the SharePoint list applies to any SharePoint List, Document Library, picture library, etc.
hide sharepoint list from view all site content
This is how we can actually hide the lists from user view programmatically using C# or PowerShell.

Programmatically setting the Hidden property of the list will also hide the list from Quick Launch bar.  However, It is possible that the document library link may be placed in Quick launch manually and still appears! So take care of it.

Hide a list from users using SharePoint Designer:

Here is how we can hide a document library or list in SharePoint:

  1. Open the site in SharePoint Designer, Right-click the target list >> Choose List settings >> General Settings
  2. Check the “Hide from browser” option
  3.  Uncheck the “Display this list on quick launch” option
  4.  Click on the “Save” button to apply the changes.
    hide document library in sharepoint 2010

Now, Open the SharePoint site in the browser and verify that your list is hidden.

To Unhide a Hidden List in SharePoint Designer:
Unhiding a hidden list is a little tricky! The above steps to hide the list in SharePoint will also hide the list from the SharePoint designer’s “Lists and Libraries” section. So, To unhide the list:

  1. Go to the “All Files” folder from the SharePoint designer left pane Tree view.
  2. Right-click on your hidden list >> Choose Properties
  3. Revert the settings “Hide from browser” to false and “Display this list on quick launch” to True! Save your settings.
  4. Now, you’ll get the hidden list back in the browser and the SharePoint designer.
Remember, although list’s hidden property is set, it will not stop users from directly hitting the list URL in the browser and getting into the list! E.g., https://sharepoint.Crescent.com/Lists/AppConfig

If you are concerned about the list’s confidentiality, To hide a list from users: You have to break list permission inheritance and remove all user permissions from the list. So that the list data will not be visible to any users (But this doesn’t control site collection Admins, Farm Admins with Web Application Policy).

To hide a list or library in SharePoint Online, refer: How to Hide a List or Library in SharePoint Online using PowerShell?

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

One thought on “How to Hide a List or Library in SharePoint?

  • change the root folder of list to prevent anyone from accessing list from bookmark link or explorer view

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *