Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show file extensions in document libraries in SharePoint 2010

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!

like image 959
sebastian Avatar asked Feb 01 '11 09:02

sebastian


2 Answers

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).

like image 196
ashish.chotalia Avatar answered Nov 15 '22 09:11

ashish.chotalia


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.

like image 29
Madhur Ahuja Avatar answered Nov 15 '22 09:11

Madhur Ahuja