Frequently, when I am training final users after having to implement a new SharePoint portal or team sites; I have to explain some Best Practices including governance rules. One of them consists to not touch the native components of SharePoint to avoid some wrong side effects. Hide SharePoint library or list afterward.
One of the most advice is to not touch default SharePoint libraries such as:
- Form Templates
- Style Library
Another case is when you have some custom SharePoint lists used for your custom developments, structural needs, or whatever... In conclusion, SharePoint lists or libraries that need to be read for all users authorized but not visible from "site contents" such as:
- list of comments
- list used for a custom footer
- list of structural references
Ok, how can you hide them? 🤔
From your SharePoint site, you can only natively set up unique permissions for a document library or list 🤓
It means that, if you want to hide a library or a list, you have to restrict all access to them for all targeted users... if you do that, these targeted users won't be able to access the data neither! In the case of the footer, it is not the desired final result, isn't it?
Moreover, some users said to me: "If we cannot delete or change them, why can we see them? Is it possible to hide them?"
When a list or library is hide, all of the content cannot appear on the search result anymore.
To use this method, you need a Windows computer and download/install SharePoint Designer which you can get here.
- Open SharePoint Designer and connect to your target Site Collection
- Open Lists and Libraries, select your SharePoint list or library
- Check the checkbox Hide from browser and save (Ctrl + S)
To use this method, you need a Windows computer and download/install PnP PowerShell which you can get here.
Thanks to PnP PowerShell, you can easily perform this kind of action.
Via PowerShell, once connected with the cmdlet
Connect-PnPOnline you can directly use this only one cmdlet:
Set-PnPList -Identity "Demo List" -Hidden $true
If you have implemented a Site Factory and you apply a PnP Template, you can add the attribute
Hidden with the value
true to your XML ListInstance node:
<pnp:ListInstance Title="Style Library" Description="Use the style library to store style sheets, such as CSS or XSL files. The style sheets in this gallery can be used by this site or any of its subsites." DocumentTemplate="" TemplateType="101" Url="Style Library" TemplateFeatureID="00bfea71-e717-4e80-aa17-d0c71b360101" Hidden="true"> <pnp:ContentTypeBindings> <pnp:ContentTypeBinding ContentTypeID="0x0101" Default="true" /> <pnp:ContentTypeBinding ContentTypeID="0x0120" /> </pnp:ContentTypeBindings> </pnp:ListInstance>
From any platform
To use this method, you just need Bash and the latest version of the Office365-CLI.
Once connected with the cmdlet
spo connect you can directly use this only one cmdlet:
spo list set --webUrl https://contoso.sharepoint.com/sites/project-x --id 3EA5A977-315E-4E25-8B0F-E4F949BF6B8F --hidden true
Hoping this post will help you 😉