Forum Discussion
Nigel Price
May 18, 2017Iron Contributor
getting all lists within a subweb
Hi I am trying to get all of the lists within a subweb :- Get-PnPLists -Web Https://sometenant.sharepoint.com/sites/this-site This keeps returning a FileNotFound error message. I have...
May 19, 2017
Try the below. Currently it seems -web is not working, alternatively you can connect to each subsite and then get the lists in those subsite.
$cred= Get-Credential
connect-pnponline -Url https://tenantname.sharepoint.com/sites/contosobeta -Credentials $cred
$subwebs=Get-PNPSubWebs -Recurse
foreach($subweb in $subwebs)
{
Connect-PNPonline -Url $subweb.Url -Credentials $cred
Get-PnPList
}Nigel Price
May 19, 2017Iron Contributor
Hi NarasimaPerumal Chandramohan
I have $lists = Get-PnPList
I tried that and when I went to access the $lists I got this ->
format-default : The collection has not been initialized. It has not been requested or the request has not been
executed. It may need to be explicitly requested.
+ CategoryInfo : NotSpecified: (:) [format-default], CollectionNotInitializedException
+ FullyQualifiedErrorId : Microsoft.SharePoint.Client.CollectionNotInitializedException,Microsoft.PowerShell.Comma
nds.FormatDefaultCommand
Regards
Nigel