Forum Discussion
Can a Library hierarchy be limited to just 2 or 3 layers?
With SharePoint, our users aren't happy yet with a metadata architecture and demand their folders.
Management doesn't want 10+ layers of folders. Users aren't convinced using Views with 2 groups.
Is it then possible to have a limit on the number of layers in a folder hierarchy, to have a hybrid approach with only 2 layers or less?
The end-result might allow the users to configure their folders:
- Documents library
- Folder 1
- Folder 1.1
- File 1.1.1.txt
- Folder 1.2
- File 1.2.1.txt
- Folder 1.3
- File 1.3.1.txt
- Folder 1.1
- Folder 1
But the user wouldn't be permitted to create subfolders below that. I am not sure if it's possible to have a Layer 1 Document Set, and a Layer 2 document set, but with no further layers possible by the user.
No- SharePoint cannot technically enforce a folder‑depth limit (2 or 3 layers). There is no built‑in setting in SharePoint Online that allows folder‑depth restriction mechanism.
Nested Document Sets are not possible in SharePoint. SharePoint does not allow creating a Document Set inside another Document Set. A Document Set can only exist at the library level, not as a sub‑item within another Document Set. There are a few workarounds to create nested Document Sets, but I wouldn’t recommend using them.
I have a few suggestions:
- Disable folder creation at the library level and use Power Automate: You can turn off the ability for users to create folders (from library setting), and then use Power Automate to create folders for them. Users can run a Power Automate flow at the library level or first level folder to create folders / sub folder. The flow can prompt the user for the folder name and then create the folder in the correct location based on your rules. In the flow, you can add logic to check the requested folder path and ensure it’s only created at the allowed level.
- Provide training and OCM for users: Keep folder creation enabled and train users to create only Level 1 and Level 2 folders. You’ll need to rely on users to follow the structure correctly, and in most cases they will. As a backup and audit measure, you can build a Power Automate flow that runs weekly or monthly to check for any folders deeper than two levels and notify the team if something exceeds the limit.
1 Reply
- virendrakIron Contributor
No- SharePoint cannot technically enforce a folder‑depth limit (2 or 3 layers). There is no built‑in setting in SharePoint Online that allows folder‑depth restriction mechanism.
Nested Document Sets are not possible in SharePoint. SharePoint does not allow creating a Document Set inside another Document Set. A Document Set can only exist at the library level, not as a sub‑item within another Document Set. There are a few workarounds to create nested Document Sets, but I wouldn’t recommend using them.
I have a few suggestions:
- Disable folder creation at the library level and use Power Automate: You can turn off the ability for users to create folders (from library setting), and then use Power Automate to create folders for them. Users can run a Power Automate flow at the library level or first level folder to create folders / sub folder. The flow can prompt the user for the folder name and then create the folder in the correct location based on your rules. In the flow, you can add logic to check the requested folder path and ensure it’s only created at the allowed level.
- Provide training and OCM for users: Keep folder creation enabled and train users to create only Level 1 and Level 2 folders. You’ll need to rely on users to follow the structure correctly, and in most cases they will. As a backup and audit measure, you can build a Power Automate flow that runs weekly or monthly to check for any folders deeper than two levels and notify the team if something exceeds the limit.