How do I get all of the subfolders in a folder using PnP PowerShell

Iron Contributor

How do I use the PnP PowerShell to get all of the subfolders in a folder ?

1 Reply

Since you already seem to have the root folder object ($folder) that you want (and assuming that all context and what not are properly in place in your script), it probably looks something like this:

$subfolders = Get-PnPProperty -ClientObject $folder -Property Folders

...at which point you can iterate through $subfolders to do whatever you need to do.

 

Hope that helps.