Running a script to get IDs and Titles of a bunch of Sub-Folders in a specific directory, where I know there are only 78 folders, because I just created them.
<code># Connect to your SharePoint site
Connect-PnPOnline -Url "https://xxxxxxxxxxxxx.sharepoint.com/teams/teamsite" -Interactive
# Get list items
$listName = "Documents"
$listItems = Get-PnPListItem -List $listName -FolderServerRelativeUrl "/teams/teamsite/Shared Documents/Inventory/2024 Inventory/Q2 2024 Inventory/Group 1"
# Extract ID and Title and store in an array
$itemData = foreach ($item in $listItems) {
[PSCustomObject]@{
'ID' = $item.Id
'Title' = $item["Title"]
}
}
# Export data to Excel
$outputPath = "C:TempGroup1IDs.xlsx"
$itemData | Export-Excel -Path $outputPath -AutoSize -Show
</code>
<code># Connect to your SharePoint site
Connect-PnPOnline -Url "https://xxxxxxxxxxxxx.sharepoint.com/teams/teamsite" -Interactive
# Get list items
$listName = "Documents"
$listItems = Get-PnPListItem -List $listName -FolderServerRelativeUrl "/teams/teamsite/Shared Documents/Inventory/2024 Inventory/Q2 2024 Inventory/Group 1"
# Extract ID and Title and store in an array
$itemData = foreach ($item in $listItems) {
[PSCustomObject]@{
'ID' = $item.Id
'Title' = $item["Title"]
}
}
# Export data to Excel
$outputPath = "C:TempGroup1IDs.xlsx"
$itemData | Export-Excel -Path $outputPath -AutoSize -Show
</code>
# Connect to your SharePoint site
Connect-PnPOnline -Url "https://xxxxxxxxxxxxx.sharepoint.com/teams/teamsite" -Interactive
# Get list items
$listName = "Documents"
$listItems = Get-PnPListItem -List $listName -FolderServerRelativeUrl "/teams/teamsite/Shared Documents/Inventory/2024 Inventory/Q2 2024 Inventory/Group 1"
# Extract ID and Title and store in an array
$itemData = foreach ($item in $listItems) {
[PSCustomObject]@{
'ID' = $item.Id
'Title' = $item["Title"]
}
}
# Export data to Excel
$outputPath = "C:TempGroup1IDs.xlsx"
$itemData | Export-Excel -Path $outputPath -AutoSize -Show
Getting the “exceeds list view threshold” even when I try to limit it to -PageSize 1