Whenever we upload
the document in document library. The document will be added and
based on the type of the document, an icon will appear under the type field.
Lets say if you upload ' .zip' file, compressed folder icon will be appear and if we
upload any of the office file type document, Respective office document file
icon will appear.
Apart from this, In SharePoint 2010.There is an IconOverlay property in SPListItem. It will be helpful in creating the overlay for the type Icon.
The practical uses
of these property are
1. we can set a common
overlay icon for the particular content type. User can identify
the file type of the document as well as the content
type by seeing the icon under type field. It improves the usability.
2. We can set this
property for the documents whose content are interrelated ,so that user can
identify by viewing the icon.
So the next
question will be, How to implement this?
Step
1:
Copy the image ( which you are plan to set as a overlay image )
e.g. plus.gif and paste it in an Images folder under layouts in
SharePoint hive or other way is to create a Images mapped folder in vs2010
SharePoint project and deploy.
Step
2:
Now programmatically set the value for icon overlay property to the name of the
file you copied to images folder .For example refer the code below.
using (SPSite site = new
SPSite("http://localhost"))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists["Shared Documents"];
foreach(SPListItem item in list.Items)
{
item.IconOverlay = "Plus.gif";
item.Update();
}
}
}