{"id":3640,"date":"2011-01-11T10:44:45","date_gmt":"2011-01-11T09:44:45","guid":{"rendered":"http:\/\/www.itwriting.com\/blog\/articles\/how-to-show-file-extensions-in-sharepoint-2007-document-lists"},"modified":"2024-10-03T11:09:57","modified_gmt":"2024-10-03T11:09:57","slug":"how-to-show-file-extensions-in-sharepoint-2007-document-lists","status":"publish","type":"page","link":"https:\/\/www.itwriting.com\/blog\/articles\/how-to-show-file-extensions-in-sharepoint-2007-document-lists","title":{"rendered":"How to show file extensions in SharePoint 2007 document lists"},"content":{"rendered":"<p>Someone asked me how to show file extensions in SharePoint 2007 document lists. Otherwise, you cannot tell without squinting closely at the icon (or hovering the mouse over it) whether a document is in the new or old Microsoft Office format.<\/p>\n<p><a href=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/01\/image_thumb110.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image_thumb1\" border=\"0\" alt=\"image_thumb1\" src=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/01\/image_thumb1_thumb.png\" width=\"404\" height=\"257\" \/><\/a><\/p>\n<p>It was interesting to investigate, because it shows how fiddly SharePoint can be, even with what looks like a simple request. I thought perhaps I could add a column, but despite hunting through a long list, could not find one for the file extension. Then I did a hunt on Google and found advice to edit allitems.aspx or onet.xml. I figured it would be safer to create a new view, so that there is an easy way back. Here\u2019s what I did.<\/p>\n<p>First, in a Documents page&#160; on the site I dropped down Settings and chose Create View.<\/p>\n<p><a href=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/01\/image_thumb21.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image_thumb2[1]\" border=\"0\" alt=\"image_thumb2[1]\" src=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/01\/image_thumb21_thumb.png\" width=\"244\" height=\"167\" \/><\/a><\/p>\n<p>I chose to Start from an existing view, using the default All Documents as the base.<\/p>\n<p><a href=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/01\/image_thumb31.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image_thumb3\" border=\"0\" alt=\"image_thumb3\" src=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/01\/image_thumb3_thumb.png\" width=\"190\" height=\"74\" \/><\/a><\/p>\n<p>I called the view Detailed and clicked OK to save it.<\/p>\n<p><a href=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/01\/image_thumb41.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image_thumb4[1]\" border=\"0\" alt=\"image_thumb4[1]\" src=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/01\/image_thumb41_thumb.png\" width=\"244\" height=\"104\" \/><\/a><\/p>\n<p>Next, I installed SharePoint Designer 2007, which is a <a href=\"http:\/\/www.microsoft.com\/downloads\/en\/details.aspx?FamilyID=baa3ad86-bfc1-4bd4-9812-d9e710d44f42&amp;displaylang=en\" target=\"_blank\" rel=\"noopener\">free download<\/a>. I ran it, and opened the site by choosing File \u2013 Open Site and entering the URL of the SharePoint site. I navigated to Detailed.aspx and opened it.<\/p>\n<p>The next step is to right-click over the section of the page that has the list of documents (this is a web part) and choose Convert to XSLT Data View.<\/p>\n<p><a href=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/01\/image_thumb51.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image_thumb5\" border=\"0\" alt=\"image_thumb5\" src=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/01\/image_thumb5_thumb.png\" width=\"225\" height=\"244\" \/><\/a><\/p>\n<p>SharePoint Designer whirred for a moment, and then showed the web part in a slightly different format. <\/p>\n<p>Now you have a couple of choices. If you want to have the extension in its own column, right-click over the Name column and choose Insert &#8211; Column to the right.<\/p>\n<p><a href=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/01\/image_thumb22.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image_thumb\" border=\"0\" alt=\"image_thumb\" src=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/01\/image_thumb_thumb.png\" width=\"244\" height=\"201\" \/><\/a>&#160;<\/p>\n<p>Once the column is created, click in the grey header row and type a name, say Ext. Then right-click in an empty cell in the new column, and choose Insert Formula. In the formula dialog, double-click File Type which is in the Rows \u2013 Row section of the tree on the left. Click OK.<\/p>\n<p><a href=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/01\/image_thumb23.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image_thumb2\" border=\"0\" alt=\"image_thumb2\" src=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/01\/image_thumb2_thumb.png\" width=\"404\" height=\"299\" \/><\/a><\/p>\n<p>Now save the modified view. If you browse to SharePoint now and select that view, you can see the file extensions.<\/p>\n<p><a href=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/01\/image_thumb42.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image_thumb4\" border=\"0\" alt=\"image_thumb4\" src=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/01\/image_thumb4_thumb.png\" width=\"404\" height=\"217\" \/><\/a><\/p>\n<p>Very good; but why can\u2019t we see the file extension as part of the file name? We can. Re-open detailed.aspx in SharePoint Designer. Delete the Ext column. Right-click a cell in the Name column in the web part and choose Edit Formula. Currently it looks like this:<\/p>\n<blockquote>\n<p>ddwrt:UrlBaseName(string(@LinkFilename))<\/p>\n<\/blockquote>\n<p>We need to modify this to show the file extension. Now, in case you are wondering, the ddwrt namespace is documented <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/dd583143(v=office.11).aspx\" target=\"_blank\" rel=\"noopener\">here<\/a>; it does not turn up if you search Help in SharePoint Designer. The formulas are documented <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms439470(v=office.12).aspx\" target=\"_blank\" rel=\"noopener\">here<\/a>; they don\u2019t show up in Help either. So&#160; UrlBaseName is a function that strips the file extension, while LinkFileName is mysteriously described thus:<\/p>\n<blockquote>\n<p>Returns a GUID that represents the icon that is used to create a link to a file in a document library, where the file can be edited by using a menu. <\/p>\n<\/blockquote>\n<p>If you simply remove the UrlBaseName function you will get the full filename:<\/p>\n<blockquote>\n<p>string(@LinkFilename)<\/p>\n<\/blockquote>\n<p><a href=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/01\/image_thumb71.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image_thumb7\" border=\"0\" alt=\"image_thumb7\" src=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/01\/image_thumb7_thumb.png\" width=\"404\" height=\"231\" \/><\/a><\/p>\n<p>You could also use the formula @FileLeafRef \u2013 the result is exactly the same. FileLeafRef is documented just as mysteriously:<\/p>\n<blockquote>\n<p>Returns a GUID that represents information about the server-relative URL for the file node that is associated with the specified Windows SharePoint Services object.<\/p>\n<\/blockquote>\n<p>Still, maybe there is some good reason why LinkFileName was used in the original formula.<\/p>\n<p>Note that you can make Detailed.aspx the default view if you wish. Just edit the view in SharePoint and check the option to Make this the default view.<\/p>\n<p><em>Helpful post? <a href=\"http:\/\/www.itwriting.com\/blog\/sponsor-itwriting-com-for-ad-free-browsing\" target=\"_blank\" rel=\"noopener\">Sponsor ITWriting.com<\/a> for ad-free access to the site<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Someone asked me how to show file extensions in SharePoint 2007 document lists. Otherwise, you cannot tell without squinting closely at the icon (or hovering the mouse over it) whether a document is in the new or old Microsoft Office format. It was interesting to investigate, because it shows how fiddly SharePoint can be, even &hellip; <a href=\"https:\/\/www.itwriting.com\/blog\/articles\/how-to-show-file-extensions-in-sharepoint-2007-document-lists\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">How to show file extensions in SharePoint 2007 document lists<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2036,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-3640","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/pages\/3640","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/comments?post=3640"}],"version-history":[{"count":1,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/pages\/3640\/revisions"}],"predecessor-version":[{"id":12221,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/pages\/3640\/revisions\/12221"}],"up":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/pages\/2036"}],"wp:attachment":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/media?parent=3640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}