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
This blog is about my history as a software engineer utilizing technologies C#, Java, React, JavaScript, .NET Core, SQL Server , Oracle, 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 my ADVERTISING links to help support this blog. Thank you.
Friday, August 05, 2005
Wednesday, August 03, 2005
Streaming images from memory
Well fellow .NET developers I thought you would find this article very helpful. Thanks Troy Tucker for the code snippet on getting the image to stream from memory:
ASP.NET: Create Snazzy Web Charts and Graphics On the Fly with the .NET Framework -- MSDN Magazine, February 2002: http://msdn.microsoft.com/msdnmag/issues/02/02/ASPDraw/ Article is awesome…
//NEW CODE for displaying IMAGE from MEMORY
MemoryStream myStream;
Byte[] imgByte = (Byte[])myCollection;
myStream = new MemoryStream(imgByte);
System.Drawing.Image _image = System.Drawing.Image.FromStream(myStream);
//System.Drawing.Image _newimage = _image.GetThumbnailImage(,, null, new System.IntPtr());
Response.ContentType = "image/jpeg"; //Make sure this is not jpg instead of jpeg!!!!!!!!!!
_image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
ASP.NET: Create Snazzy Web Charts and Graphics On the Fly with the .NET Framework -- MSDN Magazine, February 2002: http://msdn.microsoft.com/msdnmag/issues/02/02/ASPDraw/ Article is awesome…
//NEW CODE for displaying IMAGE from MEMORY
MemoryStream myStream;
Byte[] imgByte = (Byte[])myCollection;
myStream = new MemoryStream(imgByte);
System.Drawing.Image _image = System.Drawing.Image.FromStream(myStream);
//System.Drawing.Image _newimage = _image.GetThumbnailImage(,, null, new System.IntPtr());
Response.ContentType = "image/jpeg"; //Make sure this is not jpg instead of jpeg!!!!!!!!!!
_image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
Subscribe to:
Posts (Atom)