Thursday, November 29, 2007

Displaying Custom Icon in Document Library

It’s easy to display custom icon for documents in the Document Library. By default if a file extension is not know to SharePoint (doesn’t has an entry in DOCICON.xml) then it will display a default icon “ICGEN.GIF”.

Instead of displaying the Default Icon in the document library, I want to display a custom icon. To do this, we should know about “DOCICON.xml” file. This file resides in “Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\XML “. This file defines mapping between each file extension and its icon.

You can even define your own file extension and associate a custom icon to that file extension. It is also possible to change already defined icons. Changes to the “DOCICON.xml” will affect all site definitions under the front-end web server. So the changes should be made with extreme caution.

See the below document library which displays a default icon.




To change the default icon to a custom icon

1) Create a 16x16 icon in “Local_Drive:\Program Files\Common Files\Microsoft

Shared\Web Server Extensions\12\TEMPLATE\IMAGES” location

2) Take a copy of “DOCICON.xml” – Take a backup of this file


3) Open “DOCICON.xml” and navgaete to the “Default” node and replace the “icgen.gif”
by your custom icon name.



4) Reset IIS.

Now you can see the default icon is replaced by the custom icon.




1 comment:

Unknown said...

Thanks, this works well and make your library look much better you saved me a ton of time....
Tony
TWHSI