How to Restrict SharePoint File Uploads by File Name
Question details
The user wants to know if it is possible to block specific file uploads in SharePoint based on exact file names, and what practical alternatives or workarounds exist.
- Product
- Microsoft SharePoint
- Device & OS
- not provided
- Scenario
- Managing SharePoint document libraries and enforcing strict file naming conventions or restrictions.
- Observed behavior
- SharePoint allows uploads regardless of the file name, as there is no standard built-in setting to block them based on specific naming criteria.
Ensure you have the necessary administrative permissions in your SharePoint environment to create Power Automate flows or execute PowerShell scripts.
Use Power Automate to Remove Noncompliant Files
Since SharePoint doesn't natively block uploads by name, a Power Automate flow can automatically delete or move files with restricted names immediately after they are uploaded.
While column validation exists in SharePoint, it does not stop the initial upload of a file. Power Automate provides an automated post-upload cleanup method to enforce your naming conventions.
Navigate to Microsoft Power Automate and create a new automated cloud flow. Select the trigger 'When a file is created (properties only)' for your specific SharePoint site and library.
Add a 'Condition' action to check if the 'File name with extension' dynamic content contains or exactly matches your restricted keywords or file names.
In the 'If yes' branch of the condition, add the 'Delete file' action for SharePoint. Map the 'Identifier' field to the Identifier dynamic content from the trigger to remove the noncompliant upload.
Utilize PnP PowerShell for Scheduled Cleanup
For advanced administrative control, scheduled PowerShell scripts can identify and remove files with restricted names in bulk.
Discover WPS Office for Seamless Document Management
While dealing with complex SharePoint upload restrictions, managing the actual documents shouldn't be a hassle. WPS Office provides a lightweight, highly compatible alternative to Microsoft Office, letting you create, edit, and collaborate on documents for free.

Frequently Asked Questions
Can I use SharePoint column validation to block uploads by file name?
No, column validation only prevents users from saving metadata if it doesn't meet specific criteria; it does not block the initial file upload process into the document library.
Are compliance policies able to restrict exact file names in SharePoint?
Compliance policies are generally designed for content scanning (like identifying sensitive data) or blocking specific file types entirely, rather than restricting exact or partial file names.
Will Microsoft add a built-in feature to block file names in SharePoint?
Currently, there is no built-in feature planned for this exact functionality. Administrators are encouraged to submit this as a feature request through the official Microsoft SharePoint feedback portal.




