I need to display the file extensions of the files in a Document library in a column. I have done a bunch of searching and came across solutions but they don't seem to be working for me.

This is what I have been trying to do:

  1. Open SPD and select my list
  2. Select the view that I want to add file extension column to
  3. Since I already created the column in the list setting on SP I just right-click in the first row of that column and 'Insert Formula', then enter this: @FileLeafRef.Suffix

Now nothing happens, my items don't show the extensions in the column in SPD and not in SP either.

Is there something I am doing wrong with this?


Using as a formula


should return the full name (extension included) of the document (notice that using @FileLeafRef should return the same results). So, if you want to use @FileLeafRef you should strip the name from the returned string. This formula

ddwrt:GetFileExtension(string(@FileLeafRef ))

should give the expected result.

As an alternative, you should be able to use:


(see this link, provided with screenshot).

| improve this answer | |
  • For some reason simply @FileLeafRef just didn't work for me but this does ddwrt:GetFileExtension(string(@FileLeafRef )) Thanks! SPArchaeologist! – Tudor Sep 18 '12 at 16:05
  • Glad you worked it out. You could also try and see if the linked tutorial (the one using @File_x0020_Type) works, but I guess there is no need for that if the other solution is working. – BlueSoul Sep 19 '12 at 9:59
  • 1
    I actually tried selecting FileType from the list which would give the @File_x0020_Type if I'm not mistaken...but that did not work, the only one I was able to get working was the GetFileExtension that you mentioned. However, the FileLeafRef worked fine on another server and environment, so I don't really have any idea why some of the options work and others don't – Tudor Sep 19 '12 at 15:32
  • It could be something related to the list content types, available fields or view definitions. Anyway, since you got it working, I would avoid to open that can of worms ^_^' – BlueSoul Sep 20 '12 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.