Scroll To Top
Reader Level:

Define blocked file types in SharePoint 2010

By Vijai Anand Ramalingam on Feb 09, 2011
We will be seeing about blocked file types in SharePoint 2010.

In this article we will be seeing about blocked file types in SharePoint 2010. Each Web application maintains a list of blocked file types that is based on file name extensions which can be restricted from being uploaded or downloaded.

Using Central Administration:

  • Go to Central Administration => Security => General Security => Define blocked file types.

  • Select the web application from the drop down.
  • Type the file extension that has to be added in the blocked file types.
  • Click on Ok.


Using Visual Studio 2010:

  • Open Visual Studio 2010.
  • Go to File => New => Project.
  • Select Console Application from the installed templates.
  • Enter the Name and click Ok.
  • Add the following references.

    o Microsoft.SharePoint.dll
  • Add the following namespaces.

    o using Microsoft.SharePoint;
    o using System.Collections.ObjectModel;
  • Replace the code with the following.

     string webAppUrl = "http://serverName:10/";
     string addBlockFileType ="aspx";
     string removeBlockFileType ="asp";
     SPWebApplication webApp =SPWebApplication.Lookup(new Uri(webAppUrl));
     Collection<string> blockFileTypes = webApp.BlockedFileExtensions;
     foreach (string fileExtension in blockFileTypes)
         // displaying all the file extensions that are blocked

     // adding blocked file type

     // removing blocked file type


  • Build the solution.

  • Hit F5.

  • All the file extensions from the blocked file type will be displayed as shown in the following.


  • A new file extension "aspx" is added and the existing file extension "asp" is removed successfully.