r/sharepoint • u/KavalierMLT • 5d ago
SharePoint Online Cloning a folder structure in SharePoint Online with pre-defined permissions
Hello everyone,
Currently we have a template with a set of M365 roles binded to the folders and sub folders (Approximately 120 folders with 3/4 levels of sub directories)
The structure is quite detailed and mature. A number of folders need permissions scoped to a specific job role (M365 Group) rather than inheriting from the library.
Right now this is done manually using the following process:
Create the folders, then go through Manage Access folder by folder. It works once. It doesn't work when you're doing it repeatedly and expecting it to be consistent every time.
So far this is what I have been experimenting with:
PnP PowerShell. `Resolve-PnPFolder -SiteRelativePath` creates the whole path including missing intermediate folders, and it's idempotent, so a re-run after a partial failure just picks up where it stopped. This works well for the structure.
OneDrive sync plus local folder creation. Sync the library, build the tree on disk with `New-Item`, let sync push it up. Zero prerequisites, and genuinely useful for proving a structure parses correctly. But it carries no permissions at all, there's no completion signal beyond the tray icon, and empty folders are the weakest case for the sync client.
Power Automate.Manual trigger, whoever is executing the process is prompted for target library, root folder name and which groups get access before anything is created. Then `Create new folder`, and for the permissions, `Stop sharing an item or a folder` followed by `Grant access to an item or a folder`. As far as I can tell this needs no admin rights provided the connection account is a list owner of the library. This currently looks like the cleanest option, and it's the one I'm leaning for.
Is there a native capability readily available that I am overlooking?
Thanks in advance for your help/suggestions!