views:

1178

answers:

3

We have a SharePoint Document library, where we store html files with links to external files. Samples:

mypicture.jpg.html

mywordfile.docx.html

mypdffile.pdf.html

and so on. Now by default all Files show up with the HTML Icon, referenced in the DOCICON.XML file. Thats of course correct as the .html extension shows, it is a HTML file. But we want the files to have different icons, based on their original file type.

Is there a way to automatically change the Icon

  • during rendering or
  • when we save the file to the library (via SharePoint API)?

Any other approachs?

A: 

For a full listing of icon files see all "ic*.gif" files in the TEMPLATE\IMAGES directory under the 12 hive. Unfortunately, this will not solve your problem, but this is where you can change it based on the extension, if you so choose.

Note that a blog I wrote a while back has a different focus, but does discuss where the icons come from: http://wiki.threewill.com/display/is/2007/10/14/External+Link+for+Editing+a+SharePoint+Document.

Kirk Liemohn
+2  A: 

Why not use a little jquery to change the icon during rendering? Each doc in your library should be contained in

<td class="ms-vb-icon"><a tabindex=...><img ... src="/_layouts/images/ichtm.gif"></a></td>

I think you can slurp that into an array, assign a new var that's just the href stripped of path/filename. and .html, and use that to replace htm in the src tag.

vinny
Thanks! Change it during rendering seems a good way. Sample jquery search for the correct img entity:$("td[class='ms-vb-icon'] img[title$='jpg.html']").attr("src", "/_layouts/images/icjpg.gif");
Johannes Hädrich
+1  A: 

Could you not just edit the DOCICON.xml to add the ".jpg.html" and ".docx.html" extensions in?

Nat
that would be a great solution - unfortunately it doesn't work
Johannes Hädrich
That is so frustrating.
Nat