# Get icon for different file types SharePoint2010

- Link: https://sharepointtechnicalsupport.com/2015/05/05/get-icon-for-different-file-types-in-sharepoint-2010/
- Published: 2015-05-05T09:47:46+05:30
- Author: Deviprasad Panda

If you are working in custom search and your search result in returning various
file types like

[[html, pdf, excel or word etc. and you want to show a small icon for corresponding
file types then this article will help you.

This function will take parameter as the itemURL and it will return corresponding
icon URL. MapToIcon function of SPUtility class will give us the iconURL.

 private string GetIconURL(string itemURL) { string iconURL = string.Empty;

iconUrl = “/_layouts/images/” + SPUtility.MapToIcon(SPContext.Current.Web, itemURL,
string.Empty, IconSize.Size16);

return iconURL;
 }

### Share this:

 * [  X ](https://sharepointtechnicalsupport.com/2015/05/05/get-icon-for-different-file-types-in-sharepoint-2010/?share=twitter)
 * [  Facebook ](https://sharepointtechnicalsupport.com/2015/05/05/get-icon-for-different-file-types-in-sharepoint-2010/?share=facebook)
 * [  WhatsApp ](https://sharepointtechnicalsupport.com/2015/05/05/get-icon-for-different-file-types-in-sharepoint-2010/?share=jetpack-whatsapp)
 * [  Email ](https://sharepointtechnicalsupport.com/2015/05/05/get-icon-for-different-file-types-in-sharepoint-2010/?subject=%5BShared%20Post%5D%20Get%20icon%20for%20different%20file%20types%20SharePoint2010&body=https%3A%2F%2Fsharepointtechnicalsupport.com%2F2015%2F05%2F05%2Fget-icon-for-different-file-types-in-sharepoint-2010%2F&share=email)
 * [  Telegram ](https://sharepointtechnicalsupport.com/2015/05/05/get-icon-for-different-file-types-in-sharepoint-2010/?share=telegram)
 * [  LinkedIn ](https://sharepointtechnicalsupport.com/2015/05/05/get-icon-for-different-file-types-in-sharepoint-2010/?share=linkedin)
 * [  Tumblr ](https://sharepointtechnicalsupport.com/2015/05/05/get-icon-for-different-file-types-in-sharepoint-2010/?share=tumblr)
 * [  Pinterest ](https://sharepointtechnicalsupport.com/2015/05/05/get-icon-for-different-file-types-in-sharepoint-2010/?share=pinterest)

### Like this:

Like Loading…

### _Related_
