Applies To: SharePoint 2010
Nearly everyone who has ever used SharePoint has had to setup the PDF icon mapping so that PDF documents will have the familiar Adobe logo rather than the blank, unknown icon SharePoint uses by default. This is relatively simple and there are guides to do doing this all over the internet. (Microsoft’s can be found here).
Here is a very brief summay of the steps that must be performed manually on every server:
- Copy the PDF icon picture from Adobe and put it in your 14 Hive (TEMPLATE\IMAGES)
- Edit the DOCICON.xml file in your 14 Hive (TEMPLATE\XML) to add a Mapping element for pdf documents pointing to your new icon
- Reset IIS
These aren’t super complicated steps but there are some pretty big problems (or at least irritations) with using this approach:
- Manual changes can often be error-prone, especially for those not familiar with XML
- The change must be performed on every server
- The change must be performed whenever a new server is added to the farm
- The change will have to be redone in the event of disaster recovery
So, like many before me, I thought, surely this can all be automated! So I looked and I found some solutions for SharePoint 2007 and several solutions that only worked for Standalone Servers or for only one server in the farm. These were of help, but still no good for my needs. So, I wrote my own.
You can find it over on CodePlex as WireBear PDFdocIcon. There’s some stuff about it’s license over there (Free for personal and commercial use, etc.) and the basic installation instructions. It’s super easy to setup since it’s just a standard SharePoint Solution that you globally deploy.
The full source code is available on CodePlex, but I’ll be going in depth about how it works over the next few posts. But to summarize, here’s what happens:
- The Adobe PDF icon file is copied to the 14\TEMPLATE\IMAGES folder using standard resource deployment
- On Activation and Deactivation a one time Service Timer Job is run.
- On Activation, the Timer job searches for a mapping for PDF documents within the 14\TEMPLATE\XML\DOCICON.xml file. If not found, it adds one (in alphabetic order) and points it to the icon file
- An IIS Reset is performed to get the changes activated
- When Deactivating, the Timer job removes the mapping for PDF documents
- The changes will be reapplied in the event of Disaster Recovery
- The changes will be applied to new servers as they are added to your farm
- You don’t have to personally edit the 14 Hive on every server in your farm
- It makes a special place in your heart of hearts that keeps the beast at bay
In making this, I came across several blog entries that were especially helpful, here are most of these (Thanks!):
I’ve found this to be a helpful approach and I hope you do too.
5 thoughts on “Automatically Setting Up PDF Icon Mapping in SharePoint 2010”
[…] The Chris Kent Quick Fixes, Workarounds, & Neat Tricks I felt like sharing HomeAbout RSS ← Automatically Setting Up PDF Icon Mapping in SharePoint 2010 […]
[…] mentioned in a previous post, I’ve recently put together a solution for automatically configuring your SharePoint servers to […]
[…] are easy to do and you can follow them and be done. However, just like PDF Icon Mapping there are some problems with this […]
[…] run this from activation and deactivation I simply copy my design from the PDFdocIcon project and create and run a new version of the job. Since this code is nearly identical to what I’ve […]