Adding A “File Extension” Field To A Sharepoint 2013 Document Library

010714_2109_addingafile1The default “type” field in a SP library is configured to show a document type ICON, which isn’t very useful if you want to store document types for which there’s no prescribed icon. I wrote about how to add a field for file name INCLUDING its extension in “Show file type in a library view (2010 and 2013)”. But in some cases you may want to show JUST the file extension in a separate field for filtering etc purposes.It turns out there is a field in the library’s xml called “file type” that would do just that – but by default it’s only used to compute the icon to display. Since this is oddly not readily available out of the box, you will have to do a little customization with Sharepoint Designer to get a text version of this field to display in your libraries.Step 1: Create a web part.
Fire up SPD and open any wiki (aspx) or web part page (it doesn’t matter which-this is just to create the web part)
Insert a data view web part of a library on the page

010714_2118_addingafile2

Save the page and click the top of the web part to reveal the “list view tools” (easier in SPD2010 “Split View”!)
Under “options” click “add/remove columns” and add the “File Type” column. Remove any unwanted columns and save the page
This effectively rewrites the xsl used to format the list – so be aware whatever is showing in “displayed fields” is what will be visible in your list.

010714_2058_addingafile2

In the tools, select “web part” and save the web part to the “site gallery”

010714_2118_addingafile4

Step 2: Insert the web part
Now you have the formatted web part in your web part gallery, you can insert it on any page, using the “insert » web part” tool.

010714_2109_addingafile4

If the “file type” field doesn’t appear, go into the library settings » views and add the field to the view in use.

010714_2108_addingafile5

Limitations
This technique doesn’t change the default behavior of libraries and unfortunately will have to be done for every library individually. The file type field is something MSFT should have included in the library template, but for now that’s unlikely to change.
You can see an example of a revised library here »