Skip to content

Iterate through root site and subsites libraries #3186

Answered by AndersRask
pratheep-r asked this question in Q&A
Discussion options

You must be logged in to vote

Ah yes good point!

The Get-PnPList in the loop need to know that you are pointing to a new subweb!
You do this by connecting to the subweb inside the loop. Try something like this:

 foreach ($Site in $Subsites)
{
    Write-Host $Site.Url
    Connect-PnPOnline -Url $Site.Url
    Get-PnPList
}

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@pratheep-r
Comment options

@pratheep-r
Comment options

@AndersRask
Comment options

Answer selected by pratheep-r
@pratheep-r
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants