Create Folder Structure
This PnP PowerShell script automates the creation of standardized folder structures in SharePoint Online document libraries. Build consistent organizational hierarchies to improve content management and user navigation.
Purpose
This script helps you:
- Create standardized folder hierarchies across document libraries
- Ensure consistent organizational structure for content management
- Automate folder creation for project templates and workflows
- Implement governance policies through structured folder organization
Prerequisites
- PnP PowerShell module installed
- Site collection administrator permissions
- Connection to your SharePoint Online site
- Access to target document libraries
- Appropriate folder creation permissions
PowerShell Script
# Script will be added here
# Connect to SharePoint Online site
# Connect-PnPOnline -Url "https://yourtenant.sharepoint.com/sites/yoursite" -Interactive
# Your PnP PowerShell script for creating folder structures will go here
JSON Configuration File
{
"folderStructure": {
"targetLibrary": "Documents",
"createPermissions": "Inherit",
"folderHierarchy": [
{
"name": "Projects",
"description": "Project documentation and deliverables",
"subFolders": [
{
"name": "2024 Projects",
"subFolders": [
{"name": "Project Alpha"},
{"name": "Project Beta"},
{"name": "Project Gamma"}
]
},
{
"name": "2025 Projects",
"subFolders": [
{"name": "Planning"},
{"name": "Active"},
{"name": "Completed"}
]
}
]
},
{
"name": "Templates",
"description": "Document templates and standards",
"subFolders": [
{"name": "Proposals"},
{"name": "Reports"},
{"name": "Presentations"}
]
},
{
"name": "Archive",
"description": "Historical documents and records",
"subFolders": [
{"name": "2023"},
{"name": "2022"},
{"name": "2021"}
]
},
{
"name": "Policies",
"description": "Organizational policies and procedures",
"subFolders": [
{"name": "HR Policies"},
{"name": "IT Policies"},
{"name": "Financial Policies"}
]
}
]
},
"folderSettings": {
"setUniquePermissions": false,
"inheritFromParent": true,
"defaultContentType": "Document",
"enableVersioning": true
}
}
Usage Notes
- Plan folder hierarchy carefully before implementation
- Consider folder depth limitations and navigation usability
- Test folder creation on a small subset before bulk operations
- Document folder naming conventions and organizational standards
- Consider folder-level permissions and security requirements
- Avoid excessive nesting that may impact user experience
Best Practices
- Keep folder names short and descriptive
- Use consistent naming conventions across sites
- Limit folder depth to 3-4 levels for usability
- Consider metadata columns as alternatives to deep folder structures
- Document folder purposes and usage guidelines