Forum Discussion

Nigel_Price9911's avatar
Nigel_Price9911
Iron Contributor
Aug 14, 2017

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

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

  • 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.

Resources