This is one of the important reports to get details of list information for a SharePoint site or all sub sites under a site collection. I am sharing a PowerShell script which I have written for SharePoint online. I used SharePoint list properties to get details about the list title, Creation date, Last modified data, Date for last item deletion, No. of items in a list, Base Template, List GUID and few more.

The script is very simple, and you can easily modify it to get more properties. You can get the details of lists from different sites by using the below script by calling GetListDetails multiple times or modify so it can navigate through all sites.

PowerShell script to get report of all SharePoint Online lists

Below is the script to get list details for a SharePoint 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 GetListDetail($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
    Write-Host -ForegroundColor Yellow "The site URL is" $siteUrl

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

        New-Object psobject -Property $ObjectProperties

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

You need to call the GetListDetail function which will generate the report for all the SharePoint lists. Below is the detail for function call and report output.

GetListDetail ""| Out-GridView

Get detail of all lists using PowerShell

Adnan, a distinguished professional, boasts an impressive track record as a Microsoft MVP, having achieved this prestigious recognition for the eighth consecutive year since 2015. With an extensive career spanning over 18 years, Adnan has honed his expertise in various domains, notably excelling in SharePoint, Microsoft 365, Microsoft Teams, the .Net Platform, and Microsoft BI. Presently, he holds the esteemed position of Senior Microsoft Consultant at Olive + Goose. Notably, Adnan served as the MCT Regional Lead for the Pakistan Chapter from 2012 to 2017, showcasing his leadership and commitment to fostering growth within the tech community. His journey in the realm of SharePoint spans 14 years, during which he has undertaken diverse projects involving both intranet and internet solutions for both private and government sectors. His impact has transcended geographical boundaries, leaving a mark on projects in the United States and the Gulf region, often collaborating with Fortune 500 companies. Beyond his roles, Adnan is a dedicated educator, sharing his insights and knowledge as a trainer. He also passionately advocates for technology, frequently engaging with the community through speaking engagements in various forums. His multifaceted contributions exemplify his dedication to the tech field and his role in driving its evolution.

Leave a Reply