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 »

Show file type in a library view (2010 and 2013)

The default “Name” column added to a library view is a link and drops the file extension. The icons under “Type” indicate the file extension but show a default image except for a few file types. To retain and display the extension for all files add the “Name (for use in forms)” column to the view. Open the libraryOpen the library settings
Under”Views” click the view you use
In the”Columns” options, check “Name (for use in forms)”
Change the”Position from left” number to reorder the columns as needed
Save the view.
Don’t forget, you’ll have to reselect the view in the web part’s properties for the changes to be seen.

Add the ECB (edit control block) menu to an additional field in a Sharepoint 2010 library

ecb3The “ECB” menu is the contextual menu that provides quick access to functions in libraries and lists via a drop down. By default it’s only attached to the “title” field but it’s fairly easy to add to another field in a Sharepoint 2010 library. I don’t see a way to do it using the browser so you will need Sharepoint Designer 2010.Open the site and your desired library view in “design view” in SPDSelect “advanced mode” from the ribbon.
Click an item in the column you want to add the menu to.
When the little arrow and “Common xsl….” dialog box shows up, check the boxes for “Show list item menu” and “Show link to item”.

ecb1

Save the view page and check your library:

ecb2

?

Open links in a new window in Sharepoint Online lists / libraries

?If you want your links in an SP list to open up in a new window, you can change the behavior with this simple update to the list view’s xsl code. All that’s needed is to add “target=”_blank” to the line in the xsl that creates the link. I’m using a “links” list here but this works for any list with links in it.Assuming you already have a list added to a page, open that page in Sharepoint Designer 2010 in advanced mode. Select SPLIT view.The links in the list will display in the “design” view at bottom.
Click a link and you’ll see the corresponding bit of xsl highlighted in the code portion of your screen.
It will look like this:

a href=”{$url}”>
Add target=”_blank” so it looks like this:
/a> , a href=”{$url}” target=”_blank”>
Since the xsl loops through your list, every link will get updated when the page is rendered in a browser. So save the page and test it out.
NOTE: if you’re not able to find the line referenced above and don’t see 1700+ lines of code for the web part, try this:
Click the top of web part in design view where it says “webpartpages:xsltlistviewebpart”
In the ribbon click design under list view tools
Click customize xslt and then select “entire view”.
Then try to locate the code for the links in the list.