Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

Get-PnPList not working correctly with subsite's subsite #1840

Open
adarshawasthi opened this issue Dec 20, 2018 · 2 comments
Open

Get-PnPList not working correctly with subsite's subsite #1840

adarshawasthi opened this issue Dec 20, 2018 · 2 comments

Comments

@adarshawasthi
Copy link

I am using below code to get lists of all subsites. But it is failing after one level of sitecollections. i cant connect with each web using Connect-PnPOnline as it takes too much time. Please suggest how to get lists of all subsites.

$webs= Get-PnPSubWebs -Recurse

foreach ($web in $webs)
{
write-host $web.Url -ForegroundColor Cyan
$sublists = Get-PnPList -web $web
}

@adarshawasthi
Copy link
Author

i tried with below code as well but it is giving File Not Found error

$webs= Get-PnPSubWebs -Recurse

foreach ($web in $webs)
{
$SubWebs = Get-PnPSubWebs -Identity $web.Title -Recurse
foreach ($Subweb in $SubWebs)
{
write-host $Subweb.Url -ForegroundColor Cyan
$sublists = Get-PnPList -web $Subweb
}
write-host $web.Url -ForegroundColor Cyan
$sublists = Get-PnPList -web $web
}

@Ctznkane525
Copy link

Does this work?
$SubWebs = Get-PnPSubWebs -Identity $web.Url -Recurse

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants