Saturday, December 14, 2013

Blocked File Types in SharePoint 2013

Getting "Error: Sorry, something went wrong. The following file(s) has been blocked by the administrator." in SharePoint 2013? Well, This is due to Blocked File Types configuration in SharePoint 2013!


What is Blocked File Types in SharePoint 2013:
Blocked file types is a security mechanism in SharePoint to restrict files based on its extension. Obviously, You want to protect your environment from potential threats via Malicious scripts and executable. Or as part of your governance policies, You don't want your users to upload MP3 files to SharePoint, isn't it? So, blocked file types restrict specific file types from uploading to SharePoint. Users cannot upload these blocked file types to SharePoint list (as a attachment!) or a library.

Please note, SharePoint checks for blocked files ONLY based on file's extension but not actual file type. In other words, You can rename a blocked file (say: EXE file to Doc) to something else to allow SharePoint to upload the file.

Here is my another article that includes managing blocked files using PowerShell:  Manage Blocked File Types in SharePoint 2010

How to Manage Blocked File Types in SharePoint 2013:
Blocked files management is done from SharePoint 2013 Central Administration site. To manage blocked files, Navigate to Central Administration >> Security >> Define Blocked File Types.

Blocked files list is configured per web application basis. You can get the list via "Manage Web Applications" page as well.
Default blocked File Types:
By default, There are 105 blocked file types in SharePoint 2013. To allow or restrict file types, you can edit this list. Just enter one Extension per line.
  • To restrict a file type, simply add that file type extension to this list
  • To remove restriction on a particular file type, Locate and remove that extension from this list.
Here is the List of default blocked files in SharePoint 2013:
sade
adp
asa
ashx
asmx
asp
bas
bat
cdx
cer
chm
class
cmd
cnt
com
config
cpl
crt
csh
der
dll
exe
fxp
gadget
grp
hlp
hpj
hta
htr
htw
ida
idc
idq
ins
isp
its
jse
json
ksh
lnk
mad
maf
mag
mam
maq
mar
mas
mat
mau
mav
maw
mcf
mda
mdb
mde
mdt
mdw
mdz
msc
msh
msh1
msh1xml
msh2
msh2xml
mshxml
msi
ms-one-stub
msp
mst
ops
pcd
pif
pl
prf
prg
printer
ps1
ps1xml
ps2
ps2xml
psc1
psc2
pst
reg
rem
scf
scr
sct
shb
shs
shtm
shtml
soap
stm
svc
url
vb
vbe
vbs
vsix
ws
wsc
wsf
wsh
xamlx

Add/Remove SharePoint blocked file types with PowerShell:
Here is an example in PowerShell script to get/add/remove blocked file types in SharePoint 2013.
Write-host "Enter the Web Application URL:"
$WebAppURL= Read-Host
$WebApplication = Get-SPWebApplication $webAppURL
$Extensions = $WebApplication.BlockedFileExtensions
    
write-host "Blocked File Types:"
$Extensions | ForEach-Object {Write-Host $_}
 
#To Add a Blocked File type
$Extensions.Add("dlg")
$WebApplication.Update()
write-host "DLG File type has been Blocked"
 
#To Remove a Blocked File type
$Extensions.Remove("dlg")
$WebApplication.Update()
write-host "Blocked File type DLG has been Removed"

How about Files which are already uploaded?
Please note, blocked file type settings are applicable not only to new files which you are going to upload but also to existing files. So, if a blocked file type is already uploaded, you can't edit or view the file. Only delete operation is permitted.

How to restrict a specific file type in SharePoint document library?
What if you want to restrict the document library to allow only PDF files? Well, You have to develop a Event Receiver which fires and checks during "ItemAdding" event. Here is my post: Restrict File Types in SharePoint Document Library Upload using Event Receiver

Technet Reference: Manage blocked file types in SharePoint 2013



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...