I have a document library and I want to loop through all the folders I have in it. I have this piece of code
$Context.Load($List.RootFolder.Folders)
$context.ExecuteQuery()
##write-host 'RootFolder.Folders.Count:', $list.RootFolder.Folders.Count
foreach ($foldername in $list.RootFolder.Folders)
{
write-host $foldername.name
}
Which works for the folders in the root but not with subfolders. Also it returns a folder that is non existent called Forms, is this a oob folder that is hidden? How do I loop through subfolders as well?