Wednesday, August 12, 2009

Unable to open Office documents from SharePoint

I started a job recently where the test environment had problems opening, creating or editing documents in document libraries. The documents in question were office documents, and the error we got when trying to create a new one was -

..."requires a windows sharepoint services-compatible application"..

Now I knew that there was nothing wrong with the client pc I was using to browse this site, as I could use the other environments without problem. So trying to track this problem down was a real issue because it is a common issue which manifests itself when office isn't configured correctly on the client... But I knew this wasn't the case.

So I tried to create another web application in this farm to see if the issue went away (which would of suggested configuration within the site)... But the new web app had the same issue. So this led me to believe it was either a central admin setting or an issue with a file in the 12 hive of the web server.

I quickly checked central admin for any settings which could create this issue, but I couldn't really see anything which would. So I concentrated on the 12 hive and had previously checked the C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\XML\DOCICON.XML file to see if the service account had enough permissions to read it (as it had been suggested elsewhere) but the service account did have enough permision. So I decided to move onto the rest of the 12 hive as I was convinced that everything else was in place and the only problems could come from the static 12 hive files.

So I used Beyond Compare to compare the 12 hive of the "broken" machine against a working instance of Sharepoint I had elsewhere.

When going through the differences I headed straight for the C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\XML\ folder as I had a feeling any issues were likely to be shown up in there... Sure enough when I compared the DOCICON.XML file there was one line that had been inserted by a previous developer -

The line that had been added to the non working xml file was -
<Mapping Key="pdf" Value="pdf.gif">

The tag wasn't closed correctly!!

So I changed it to -
<Mapping Key="pdf" Value="pdf.gif" />

And now my site was back up and working again.

You would think that this typo might have thrown a more obvious error than it did!

If this doesn't fix your issue the other 2 places I'd check (if it is definitely a server issue) are -
Permissions of DOCICON.XML
Document Template for the Content Type or Doc Library (make sure this isn't corrupt).

Hope this helps someone.