You can hide lists and libraries in a SharePoint site using SharePoint designer or PowerShell cmdlet which can be using for different operations. There are several hidden lists in SharePoint which exists in a SharePoint site just like workflow history list, User Information list and many others which have different usage in SharePoint. Below screenshot shows the list of hidden SharePoint lists which an be found at the root site.

PowerShell Script to generate report of hidden lists

Below is a simple PowerShell script which I used to generate report of hidden lists. I have written a function GetHiddenListDetail which take the site url and return the list of all hidden list on that specific site.

Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

function GetHiddenListDetail($siteUrl)
{
    #*** you can also move below line outside the function to get rid of login again if you need to call the function multiple time. ***
    $Cred= Get-Credential
    
    $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteURL) 
    $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
    $ctx.Credentials = $credentials 

    $web = $ctx.Web  

    $lists = $web.Lists
    $ctx.Load($lists)
    $ctx.ExecuteQuery()
    Write-Host -ForegroundColor Yellow "The site URL is" $siteUrl

    #output the list item count
    $tableListNames = foreach ($list in $lists)
    {
		if($list.Hidden)
		{
			$ObjectProperties = @{
				ListName = $list.Title
				ItemCount = $list.ItemCount
				"BaseTemplate ID" = $list.BaseTemplate
				Created = $list.Created 
				BaseType = $list.BaseType
				Id = $list.Id 
				LastItemModifiedDate = $list.LastItemModifiedDate 
				Description = $list.Description
			}

			New-Object psobject -Property $ObjectProperties
		}
    }

    Write-Host -ForegroundColor Green "List item count completed successfully"
    return $tableListNames;
}

Use below cmdlet for executing the above function, in below cmdlet I have added the site URL and used grid view to show the data.

GetHiddenListDetail "https://mstalk.sharepoint.com"| Out-GridView

Get Hidden lists using PowerShell

Adnan is six time Microsoft MVP (Since 2015) with over 16 years of extensive experience with major expertise on SharePoint, SharePoint based development, Microsoft 365, Microsoft Teams, .Net Platform and Microsoft BI. He is currently working Sr Microsoft Consultant at Olive + Goose. He is MCT Regional Lead for Pakistan Chapter since 2012. He is working on SharePoint for past 12 years and worked on different intranet/intranet solutions for private & govt. sector majorly in United states and Gulf region and have experience of working with multiple Fortune 500 companies. He is a trainer, technology evangelist and also speaks in community forums.

Leave a Reply