“Should I use folders in SharePoint document libraries?” is a fairly common question. The answer is simpler for Teams because the Teams app only displays channel-linked folders in the default Shared Documents library, and not any additional libraries you might create. If you’ve decided that you want to prevent users from creating folders besides those for channels in the default document library, keep reading.
Requirements
Roles & Licensing
- Site Admin/Owner/Member – To update the document library settings.
- M365 Business or Enterprise License – Any Microsoft Business or Enterprise license that includes SharePoint P1 or P2.
Apps & Modules – Update setting via PowerShell
- PowerShell – There are several versions and ways to access PowerShell, in our guide we will use PowerShell ISE.
- PnP PowerShell module – This module is used to update the document library settings and requires SharePoint Admin to run.
- Authentication – To authentication with PnP PowerShell Interactive Authentication you will need a App Registration. If you need help setting this up refer to our guide: How to connect to PnP Online with Interactive Authentication
Turn off folder creation
All teams have accompanying SharePoint team sites. When preventing folder creation, the setting change takes place on this corresponding SharePoint site. You can use any of the following methods to enable/disable folder creation:
Method 1 – Teams
Before you begin, confirm that you have member-level (or higher) access to the Team you want to disable folder creation for. Once you have confirmed this, follow these simple steps:
- Navigate to any of the standard channels linked within the team.
- Under the ‘Files’ tab, select ‘Open in SharePoint’.
- From the newly opened window, open the ‘Library settings’ and then select ‘More library settings’.
- Select ‘Advanced settings’.
- Under the ‘Folders’ section set ‘Make “New Folder” command available?’ to ‘No’.
- At the bottom of the screen, select ‘Ok’.
Method 2 – PowerShell
Before running the PowerShell commandlets, ensure you are using an account with the SharePoint Admin role and you have consent to run PnP PowerShell.
Once ready, use can use the following commands to disable folder creation on selected lists and libraries:
Connect-PnPOnline -Url <Site URL> -Interactive
Set-PnPList -Identity <List Name> -EnableFolderCreation $false
Here is the full script with built-in error handling: Disable Folder Creation.ps1
Method 3 – Third-party tools
With pipelines in SProbot, you can prevent folder creation by simply checking a single box. When users create teams using a pipeline configured this way, folder creation is automatically disabled, along with various other governance rules you configure.
To find out more about how to use SProbot pipelines, have a look at creating a pipeline to enable SharePoint and Teams governance.
Quirks
Channel Creation
New folders can be created when team members create standard channels. To prevent this, disable channel creation for members via the team settings.
OneDrive Sync
It’s still possible to create new folders through OneDrive sync even when the ‘Make “New Folder” command available?’ is set to ‘No’.
Team members can update library settings
Team members can update the ‘Make “New Folder” command available?’ library setting via SharePoint.
Private and shared channels are managed separately
Private and shared channels create separate SharePoint sites and document libraries when created. For each private or shared channel, you will need to disable folder creation separately.
Final Considerations
Restricting folder creation within a team is effective at limiting content being buried within a complex structure such as usually found on file servers. This doesn’t mean that folders are all bad; they can be useful in some scenarios, so be sure to assess a team’s requirements before implementing too many restrictions.