Sometimes when building some internal processes to organizations, it’s possible that it is required to create a SharePoint list. However, sometimes it can create confusion for the end-user that sees the list there. So we can hide that list from the SharePoint site to avoid this. Everything will work as normal on the list and it’ll be accessible via URL. This scenario can be used as well when you’re building a new list using List Formatting and you don’t want the list to be available just yet. This is possible to be done in a SharePoint with a few steps. We’ll use the PNP Powershell and Office 365 CLI to demonstrate.
If you intend to have the list back to Visible, you just need to make the value of hidden false. NOTE: If you have any PowerAutomated app, these hidden lists will not appear in the dropdown but if you use the custom property and add there the name it will work.
To install the PnP PowerShell you can follow the steps in this article. After that switch the variables on the code to your scenario.
PnP PowerShell
$listName = "LIST NAME"
$site = "https://CONTOSO.sharepoint.com/"
Connect-PnPOnline -Url $site -UseWebLogin
Set-PnPList -Identity $listName -Hidden $true
To install the Office 365 CLI you can follow the steps in this article. After that switch the variables on the code to your scenario.
Office 365 CLI
$listName = "LIST NAME"
$site = "https://CONTOSO.sharepoint.com/"
o365 login
$list = o365 spo list get --webUrl $site -t $listName -o json| ConvertFrom-Json
o365 spo list set --webUrl $site -i $list.Id -t $listName --hidden true
Conclusion
When executing this code, the changes on the site will be done immediately. The list will keep accessible via URL and all the Processes attached to that list will work as normal. The gif below shown the two codes making the list hidden. In this first post of 2020, let me also take this opportunity to wish a good year/decade to everyone.
[…] Hide SharePoint list from Site Contents | David Ramalho (Storm Technology Ltd) […]
Nice and simple and something I’ve been looking for in the modern interface for more than a year! Thanks for sharing this.
As a bonus point, the command Get-PnPList can be used to see all libraries in the site – not sure if there’s an additional filter to show which lists/libraries are hidden though.
Hi Jason,
Thanks, I happy this helped 😊 You will be able to see all your hidden lists using the command below.
Get-PnPList | Where-Object -Property hidden -EQ $true
[…] Hide SharePoint list from Site Contents – SharePoint Tricks […]
Hi David, Great Post.
I have a question to ask if I may : On a Sharepoint Page I wish to add to List of Properties linked to a List. Therefore , I need to add on the Page 2 Web items :
1- the List
2- List of Properties Linked
Do you by any chance Know if there is a way to hide the List on the Page and keep the list of Properties ?
Thank you.
Najwa.
Hi Najwa,
Unfortunately, I don’t think is possible to hide a component on the page.
My best,
David Ramalho
Thanks …list name was with spaces and name was changed later. Used Id instead of List Name to get it executed.
David – what if you just want to hide site contents from a particular SP group?
Hi,
Unfortunately, it’s not possible to remove the site contents from the Users unless you build a SharePoint Framework solution that injects CSS to hide those elements from the page.
My best,
David Ramalho
Hi, my requirement is that I don’t want any of my users to enter the site contents.
is that possible?
because when they enter the site contents they see every page and every list. how and I block access to the site contents?
Hi,
You can hide site contents if you add an SPFx extension solution to your website, however, you need to be aware that Microsoft doesn’t recommend hiding elements like that from the DOM. The reason for that is that they can change some classes on the SharePoint DOM and you could affect other areas of SharePoint.
My best,
David Ramalho