Feature Stapling in SharePoint

I want a custom list to be created by default whenever a site is created using the Team Site template. The best way to do this is to create a Feature Stapling.

Feature Stapling can be created for the site definition that is already in use. Feature Stapling has two features.

  • Stapler feature: staples another feature to the site definition
  • Staplee feature: that which will be stapled

Steps involved:-

The following is the procedure steps to to implement Feature Stapling in SharePoint:

  • Create Empty SharePoint Project
  • Create a feature
  • Create the feature stapler
  • Create FeatureAssociation.xml
  • Deploy the solution
  • Check whether the feature stapler is activated in a web application
  • Testing

Create Empty SharePoint Project

  • Open Visual Studio 2010 by going clicking “Start” then select “All Programs” | “Microsoft Visual Studio 2010” then right-click on Microsoft Visual Studio 2010 and click on “Run as administrator”.
  • Go to the File tab, click on “New” and then click on “Project”.
  • In the New Project dialog box, expand the Visual C# node, and then select the SharePoint 2010 node.
  • In the Templates pane, select “Empty SharePoint Project”.
  • Enter the Name as FeatureStapling and then click “OK”.


  • Enter the local site URL for debugging, select “Deploy as a farm solution” as in the following and then click on “Finish”.

Create a feature

In this section you will see how to create a new feature and feature receiver to create a custom list in the site.

  • In the Solution Explorer, right-click on the Feature folder and then click on “Add Feature”.


  • Rename the feature to “CreateListFeature”.
  • Double click and enter the title & description ofthe feature .
  • Select the scope as web from the drop down list.
  • Right-click on CreateListFeature and then click on the Add Event receiver.


  • Double-click on CreateListFeature.EventReceiver.cs and replace the code with the following:
protected override void FeatureDeactivatingInternal(SPFeatureReceiverProperties properties)
     SPWeb web = (SPWeb)properties.Feature.Parent;
     string listUrl = SPUrlUtility.CombineUrl(web.ServerRelativeUrl, "Lists/CertificateInformationTool")
     SPFolder folder = web.GetFolder(listUrl);
     if (folder.Exists)
         SPList list = web.Lists[folder.ParentListId];

  • The Code above creates a list on the feature activation .

Create feature stapler

In this section you will see how to create a feature stapler that is used to staple the CreateListFeature to the site definition.

  • In the Solution Explorer, right-click on the Feature folder and then click on “Add Feature”.


  • Rename the feature to “FeatureStapler”.


  • Double-click on the feature and enter the Title and Description for the feature.


  • Select the scope as WebApplication from the drop down list.

Create FeatureAssociation.xml

Now we need to create the XML file to associate the feature to the site definition.

  • In the Solution Explorer, right-click on the project, click on “Add” and then click on “New Item”.
  • Select the “Empty Element” template, enter the Name and then click on “Add”.


  • Double-click on Elements.xml and replace with the ListFeature feature Id.

                 Template Name : To which site template the feature should be associated (the                                                            format should be <site template name><configuration                                                                        number>).

  • Ensure this file is added to the FeatureStapler feature (double-click on the FeatureStapler feature and see whether in the “Items in the feature” window
    the Elements.xml file is available).


Deploy the solution

  • Right-click on the solution and then click on “Deploy Solution”.
  • Check whether the feature stapler is activated in the web application.


Now whenever we go to any of the site collections and look for the particular feature, it should be activated .
Thus, we can have this list on any site collection in a particular web application when we have this feature activated and vice-versa.




SharePoint Search 2013 File Types

SharePoint Search 2013 default supports below mentioned lists of file types. The crawl component only crawls those file types which are mentioned in “File Types” section of Search Administration” page. The content processing component indexed the content of file only if built-in or third party Format Handler (iFilter) is installed in SharePoint server

File format Format ID File name extension File name extension listed on the Manage File Types page by default
Email message eml .eml Yes
Email message nws .nws Yes
HTML html .ascx Yes
HTML html .asp Yes
HTML html .aspx Yes
HTML html .css No
HTML html .hta No
HTML html .htm Yes
HTML html .html Yes
HTML html .htw No
HTML html .htx No
HTML html .jhtml No
HTML html .stm No
MHTML document mhtml .mht Yes
MHTML document mhtml .mhtml Yes
Microsoft Excel xlb .xlb No
Microsoft Excel xlc .xlc No
Microsoft Excel xls .xls Yes
Microsoft Excel xlsb .xlsb Yes
Microsoft Excel xlsm .xlsm Yes
Microsoft Excel xlsx .xlsx Yes
Microsoft Excel xlt .xlt No
Microsoft OneNote one .one No
Microsoft PowerPoint pot .pot No
Microsoft PowerPoint ppa .ppa No
Microsoft PowerPoint pps .pps No
Microsoft PowerPoint ppt .ppt Yes
Microsoft PowerPoint pptm .pptm Yes
Microsoft PowerPoint pptx .pptx Yes
Microsoft Publisher pub .pub Yes
Microsoft Word doc .doc Yes
Microsoft Word docm .docm Yes
Microsoft Word docx .docx Yes
Microsoft Word dot .dot Yes
Microsoft Word dotx .dotx Yes
Microsoft XPS xps .xps No
Open Document Chart odc .odc Yes
Open Document Presentation odp .odp Yes
Open Document Spreadsheet ods .ods Yes
Open Document Text odt .odt Yes
Outlook item msg .msg Yes
Portable Document Format pdf .pdf Yes
Rich Text Format rtf .rtf No
Text txt .asm Yes
Text txt .bat No
Text txt .c No
Text txt .cmd No
Text txt .cpp No
Text txt .csv Yes
Text txt .cxx Yes
Text txt .def Yes
Text txt .h No
Text txt .hpp No
Text txt .lnk No
Text txt .mpx No
Text txt .php No
Text txt .trf No
Text txt .txt Yes
Text txt .url No
TIFF tiff .tif No
TIFF tiff .tiff No
Visio vdw .vdw Yes
Visio vdx .vdx Yes
Visio vsd .vsd Yes
Visio vsdm .vsdm Yes
Visio vsdx .vsdx Yes
Visio vss .vss Yes
Visio vssm .vssm Yes
Visio vssx .vssx Yes
Visio vst .vst Yes
Visio vstm .vstm Yes
Visio vstx .vstx Yes
Visio vsx .vsx Yes
Visio vtx .vtx Yes
XML xml .jsp Yes
XML xml .mspx No
XML xml .rss No
XML xml .xml Yes
ZIP zip .zip Yes

Important Points:

  • The file will not crawled and parsed if it is not listed in “File Types” section and no Format Handler (iFilter) is installed respectively. For example, you had uploaded a file of type *.twbx in SharePoint site and “twbx” is not listed in “File Types” section then it was not crawled and not available in crawl logs of SharePoint search. To make it crawl, you need to add “twbx” in “File Types” section. After adding the file type, restart the SharePoint Search service and starts Full Crawl. The file will now be available in crawl logs and you can search it with filetype:twbx.
  • The content of file can only be parsed if built-in or third party iFilters are installed. To implement custom iFilter you can read this article : http://blogs.technet.com/b/sharepointdevelopersupport/archive/2013/05/13/how-to-implement-a-custom-ifilter-in-sharepoint-2013.aspx


Default crawled file name extensions and parsed file types in SharePoint Server 2013