Wednesday, May 7, 2025

How to List All SharePoint Lists with PowerShell Using PnP

When managing SharePoint Online, administrators often need to retrieve a list of all libraries and lists in a site. With the PowerShell PnP module, this process is quick and efficient. In this post, we’ll walk through a simple script that connects to a SharePoint site and retrieves the title and description of all lists.

Prerequisites

To follow along, make sure you have the PnP PowerShell module installed. You can install it using:

Install-Module -Name PnP.PowerShell

Script Overview

Here's the script that connects to your SharePoint Online site and displays the title and description of each list:

# Connect to SharePoint site

Connect-PnPOnline -Url "https://yourtenant.sharepoint.com/sites/yoursite" -Interactive


# Get all lists

$lists = Get-PnPList


# Select and display Title and Description

$lists | Select-Object Title, Description | Format-Table -AutoSize

Use Cases

  • Auditing site contents

  • Documenting SharePoint structure

  • Identifying unused or unnamed lists

No comments:

Post a Comment