I have a question regarding the PnP Powershell and the usage.
So basically, I've created a simple foreach to iterate all subwebs to print a detail froma list. But it does not work as supposed. It doesn't do anything.
$webs = Get-PnPSubWebs -recurse -IncludeRootWeb -Includes "Lists";
foreach($web in $webs)
{
foreach ($item in web.Lists["MyCustomList"].Items)
{
write-host $item.Title;
}
}
I've tried to reproduce everything step by step in the Powershell Window:
Ok it gives me all webs with lists (firstly I didn't know I had to order lists to be included)
$webs = Get-PnPSubWebs -Recurse -IncludeRootWeb -Includes "Lists"
This shows me all the lists
$webs.Lists
But I'm stuck here:
$web.Lists.GetByTitle("MyCustomList")
This returns nothing! I've tried GetById and everything but it doens't work. I could only get a list like this: $web.Lists[20]
(with index)
Could you please assist, so that I can interate through webs, find my list and iterate through all the items in my list. (this is for sharepoint 2016)