I would like to change document icon in document library at runtime. Icon should be changed based on some condition I have in code. There is no difference what extension of file is (txt, doc, pdf, etc..). Currently I use HTTP module to parse server response and change icon in runtime. However this solution is not reliable as page HTML markup may be changed, different views has different behavior and there are issues with registration HTTP module in SharePoint 2010. Is there any API or any other reliable way to change document's icon at runtime?
I would appreciate any help. Thanks beforehand, -Petro
Here is the schema of Sharepoint 2010 standard DocIcon Field (its quite huge):
You can get DocIcon field of a library you want to modify icons for (through code) and modify its schema. As you can see there are a lot of XSLT in section, but it's quite simple and new patterns can be added without big problems (and old ones can be removed). Another way is to create your own custom field type and use it instead of standard one to display an icon.