Show file extensions in document libraries in SharePoint 2010

sebastian Source

I've got a SharePoint site collection with several sub sites each having their own document library. Now I want to add the file extensions to the document names in all those libraries. How should I do this?

I've seen tips telling you to modify the onet.xml-file, but they never look like mine do, and furthermore I don't know for sure what happens to that onet.xml-file - does it change the existing libraries? Other tips tell me to use SharePoint designer, that would mean I'll have to do it for every view in every library, wouldn't it? So I'd prefer doing it from code, where I feel more comfortable and where I can automate the process.

So, all I want is to replace the "Name (linked to document with edit menu)" with the "Name (for use in forms)" but still keep the link and the edit menu. I've found I need to use the FileLeafRef-field, but I don't know how!

sharepointsharepoint-2010

Answers

answered 8 years ago Madhur Ahuja #1

If you need to do it for only one library, sharepoint designer is the way to go. You can convert the view to XSLT view and use the FileLeaFref field.

If you want to do it for all the libraries, there is no easy way. You can replace the Name column but if you want to display the link and edit menu as well, you will need to go with some Jquery hack which I believe nobody has done till now.

answered 8 years ago ashish.chotalia #2

You can follow below pts.

  1. Open SharePoint Designer
  2. Select the WebPartPages:ListViewWebPart control
  3. Right-click, Convert to XSLT Data View
  4. Insert a new column into the data view
  5. I typed "Extension" in the gray header row
  6. In the first row below the header, right click and choose Insert Formula -> Expand the tree under Rows, Row, and select File Type, click OK.

Reference Link : http://social.technet.microsoft.com/Forums/en-US/sharepointgeneral/thread/8222d979-f5ff-4665-a168-7245e4325b2f/

Or

Modify the display pattern in ONET.XML - add Name="File_x0020_Type"/> before Name="Created_x0020_Date"> . After making a change to ONET.XML you have to do IISRESET. (BEFORE ALTERING ONET.XML, PLEASE TAKE BACKUP).

answered 4 years ago user325794 #3

As changing WebPartPages with Sharepoint Designer is forbidden in our company, I had to find another workaround to this problem which works quite well for me. (but is probably not the most practical if you want to apply it to many lists at the same time). It doesn't replace the name-column, but adds an additional column only containing the file extension.

  • Create a column e.g. called FileExt
  • In Sharepoint Designer, go on Workflows --> Listworkflows
  • Choose Action --> List Actions --> Set Field in Current Item
  • "Set FileExt to Current Element: File Type" (I hope it's called "Current Element", I've a German version)
  • In the Workflow settings choose to start the Workflow automatically if a new element is added
  • In case the library already contains files I also activate to start the workflow if an element is changed. Then I add a column, fill it with any text in the data sheet view so each item gets changed and by that the workflow gets activated. Afterwards I delete the column and set the workflow back to only start if a new element is added.

Actually I hoped to be able to do the same with a calculated field but so far did not succeed..

comments powered by Disqus