Skip to content

Instantly share code, notes, and snippets.

@pstakuu
Created August 10, 2022 01:27
Show Gist options
  • Select an option

  • Save pstakuu/e499ef1b6cb456184ffd5adb9fe75efe to your computer and use it in GitHub Desktop.

Select an option

Save pstakuu/e499ef1b6cb456184ffd5adb9fe75efe to your computer and use it in GitHub Desktop.
Limited run for test
$SiteURL = "https://company.sharepoint.com"
Connect-PnPOnline $SiteURL -UseWebLogin
$FolderSiteRelativeURL = "/Shared Documents/path/path"
$downloadPath = "C:\temp"
$folder = Get-PnpFolder $FolderSiteRelativeURL
Get-PnPProperty -ClientObject $Folder -Property ServerRelativeUrl, Folders | Out-Null
$Web = Get-PnPWeb -Includes ServerRelativeUrl
$SiteRelativeUrl = $Folder.ServerRelativeUrl -replace "$($web.ServerRelativeUrl)", [string]::Empty
#show items
Get-PnPFolderItem -FolderSiteRelativeUrl $SiteRelativeUrl -ItemType File
$ItemCount = Get-PnPFolderItem -FolderSiteRelativeUrl $SiteRelativeUrl -ItemType File | Measure-Object | Select -ExpandProperty Count
$SubFolderCount = Get-PnPFolderItem -FolderSiteRelativeUrl $SiteRelativeUrl -ItemType Folder | Measure-Object | Select -ExpandProperty Count
"Item count: $ItemCount"
"Subfolder count: $SubFolderCount"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment