Get All Document Libraries in SharePoint Online using PnP PowerShell

Requirement: Get all document libraries in SharePoint Online using PowerShell PnP

PnP PowerShell to Get All Document Libraries in SharePoint Online 
Document libraries can be filtered from Lists collection by either base template or base type properties. Here is how:
#Set Variables
$SiteURL = "https://crescent.sharepoint.com/sites/marketing"
 
#Connect to PNP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential) #-UseWebLogin

#Get all document libraries - Exclude Hidden Libraries
$DocumentLibraries = Get-PnPList | Where-Object {$_.BaseTemplate -eq 101 -and $_.Hidden -eq $false} #Or $_.BaseType -eq "DocumentLibrary"

#Get Document Libraries Name, Default URL and Number of Items
$DocumentLibraries | Select Title, DefaultViewURL, ItemCount
This PowerShell script gets all document libraries from the given site URL
Get all document libraries in SharePoint Online using PowerShell PnP
Here is my another script to get all document libraries in SharePoint Online site using CSOM PowerShell: SharePoint Online: PowerShell to List All Document Libraries
Get All Document Libraries in SharePoint Online using PnP PowerShell Get All Document Libraries in SharePoint Online using PnP PowerShell Reviewed by Salaudeen Rajack on February 16, 2019 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.