SharePoint: Adding icons for other document types (like PDF)
I've seen lots of questions on various SharePoint newsgroups about how to get PDF files to show up with the right icon in document libraries. The process is documented in the WSS admin guide, but it's not that easy to find. I'm working with the folks in PSS/Product Team to try to get a KB article on this topic. In the meantime, though, here it is:
At a high level, all you need to do is get the icon into the \template\images directory, and then map the extension to the icon in \template\xml\docicon.xml. Then you reset IIS, and voilĂ , you have your mapping.
So, let's say you've already dropped icpdf.gif into the \template\images directory. You would then modify docicon.xml to add the mapping that points to the icon (in bold below):
<DocIcons> <ByProgID> <Mapping Key="Excel.Sheet" Value="ichtmxls.gif"/> <Mapping Key="PowerPoint.Slide" Value="ichtmppt.gif"/> <Mapping Key="Word.Document" Value="ichtmdoc.gif"/> </ByProgID> <ByExtension> <Mapping Key="doc" Value="icdoc.gif"/> <Mapping Key="gif" Value="icgif.gif"/> <Mapping Key="htm" Value="ichtm.gif"/> <Mapping Key="html" Value="ichtm.gif"/> <Mapping Key="ppt" Value="icppt.gif"/> <Mapping Key="pdf" Value="icpdf.gif"/> </ByExtension></DocIcons>
Now, let's say you also want to add a new default icon for unknown file types, called icunk.gif. Again, you'd drop the icon in the \template\images directory, but this time you'd modify docicon.xml to add a default value that is used if a matching can't be made by ProgID or Extension (in bold below):
<DocIcons>
<ByProgID>
<Mapping Key="Excel.Sheet" Value="ichtmxls.gif"/>
<Mapping Key="PowerPoint.Slide" Value="ichtmppt.gif"/>
<Mapping Key="Word.Document" Value="ichtmdoc.gif"/>
</ByProgID>
<ByExtension>
<Mapping Key="doc" Value="icdoc.gif"/>
<Mapping Key="gif" Value="icgif.gif"/>
<Mapping Key="htm" Value="ichtm.gif"/>
<Mapping Key="html" Value="ichtm.gif"/>
<Mapping Key="ppt" Value="icppt.gif"/>
<Mapping Key="pdf" Value="icpdf.gif"/>
</ByExtension>
<Default>
<Mapping Value="icunk.gif"/>
</Default>
</DocIcons>
Happy mapping, and don't forget to restart IIS when you're done!
Resource: http://blogs.msdn.com/lauraj/archive/2004/01/21/61187.aspx
Robert Dannelly blog, Over the internet you can find me by "robert dannelly blog". The blog is an ongoing blog of my software engineering over technologies C#, VB.NET, Java, React, JavaScript, .NET Core Current, SQL Server 7 - Current Version, GIT, GitHub, Jira, Azure, AWS and HTML5. “I have not failed. I've just found 10,000 ways that won't work.” Thomas A. Edison, please click on all links to help support this blog. Thank you. “As an Amazon Associate, I earn from qualifying purchases.”
No comments:
Post a Comment