Requirement: Block syncing of specific file types in OneDrive for Business.
How to Block File Types in OneDrive for Business?
By default, Users can upload all types of files in their OneDrive for Business folder. However, for security and compliance reasons, we can restrict users from syncing specific file types in OneDrive for Business. This guide will explain how to block specific file types in OneDrive for Business using the OneDrive admin center and PowerShell.
- Login to the SharePoint Admin center at https://YourDomain-Admin.SharePoint.com
- Click on the “Settings” link under the left navigation
- On the settings page, click on “Sync” next to the “OneDrive” App. >> Enable the “Block syncing of specific file types” checkbox and enter each file type per line.
- Click on “Save” to commit your changes.
These changes may take up to 24 hours to reflect. In the next sync cycle, If OneDrive for Business client detects any file matching the blocked file extension, any attempt to sync a blocked file type will give an error message “Item name is not allowed in the cloud”!
Also, on the OneDrive client, users get the “OneDrive needs your attention. <File-Name> The name of a type isn’t allowed. Please rename the item or remove it from your OneDrive.” error.
Please note, this configuration will not *prevent* you from uploading a blocked file to either OneDrive for Business site or to OneDrive client sync location in your local machine. However, this prevents the sync from both ends!
The OneDrive sync folder also displays an error:
PowerShell to Block File Types in OneDrive for Business:
We can also block file types using PowerShell as:
#Parameters $TenantAdminURL = "https://crescent-admin.sharepoint.com" #Connect to Admin Center Connect-SPOService -Url $TenantAdminURL -Credential (Get-credential) #Set blocked File types Set-SPOTenantSyncClientRestriction -ExcludedFileExtensions "exe;mp3;mp4"
This PowerShell script blocks file types exe, mp3 and mp4 to not being synced with OneDrive for Business. Microsoft reference on block syncing of specific file types: https://docs.microsoft.com/en-us/OneDrive/block-file-types
In conclusion, blocking the syncing of specific file types in OneDrive for Business can be a useful way to improve security and compliance within your organization. Using the SharePoint Admin Center, you can easily block the syncing of specific file types and prevent users from syncing potentially sensitive or dangerous files. Additionally, you can also use PowerShell to configure the blocked file types, which can be useful for automating the process and managing large numbers of file types. Implementing this feature can help organizations to better protect their data and improve the overall security of their OneDrive for Business environment.