Hide SharePoint list from Site Contents

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.

6 Comments

  1. Jason Brownhill said:

    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.

    January 14, 2020
    Reply
    • David Ramalho said:

      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

      January 14, 2020
      Reply
  2. Najwa said:

    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.

    April 7, 2020
    Reply
    • David Ramalho said:

      Hi Najwa,

      Unfortunately, I don’t think is possible to hide a component on the page.

      My best,
      David Ramalho

      April 22, 2020
      Reply

Leave a Reply

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