While our current focus, in terms of SharePoint, is on 2010 and looking ahead to SharePoint 2013, we support several clients that have 2007 environments. Occasionally, these environments present us with some interesting challenges.
Recently, I was doing some work for a client that reported several problems opening Excel files from a SharePoint document library.
- Users were being prompted several times to enter their credentials when opening the Excel file even though they were already logged in to SharePoint.
- After an Excel file was checked out from SharePoint and then opened, the document would be empty. I checked the SharePoint drafts folder and the file was only a few KB instead of around 1 MB like it should be. Once the check-out was discarded the document could be opened read-only without a problem.
- Users received an error message when trying to open an Excel file, “The file you are trying to open, ‘filename.xls’, is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?”. This error seemed to be related to the previous problem but it did not come up every time a file was blank.
- Users receive an error message when trying to open an Excel file, “Error: Updates are currently disallowed on GET requests. To allow updates on a GET, set the ‘AllowUnsafeUpdates’ property on SPWeb.”
None of these problems were consistent. They did not occur for every user or for every Excel file which seemed odd.
My first thought was to try to address the issue of the users being prompted for credentials even though they were logged in. I have seen this issue many times. The client has multiple domains so I assumed it might related to cross-domain authentication, however users in the same domain as the SharePoint farm were experiencing this problem. Even so, I put the SharePoint site in the Intranet zone which often corrects problems like this but it had no effect. I also checked the Credential Manager in Control Panel to make sure there were no old credentials stored but again, this did not help. I even tried adding a registry entry “AuthForwardServerList” in the WebClient Parameters section. This related to an issue in Windows 7 that caused intranet sites that used fully qualified domain names to be treated as internet sites even if they were in the intranet zone. Unfortunately, this also failed to correct the problem.
At this point I decided to look at some of the other errors. As I researched the error about GET requests and AllowUnsafeUpdates I found some references to problems opening image library files when Blob Caching was enabled. I checked the web.config file to see if Blob Caching was enabled for Excel files and sure enough it was. I also found some information that indicated that Blob Caching caused the http headers to be changed and although it seemed like a long shot, I was hoping this might resolve more than just that one error. I removed the xls extension from the Blob Cache line and tested again.
Even though the errors had been somewhat inconsistent, I had been able to reproduce them, but after making the change to the web.config I could not reproduce them. Not just the one or a couple of them, I could no longer reproduce any of the problems. I asked the users who had experienced these problems to test and they also were not able to reproduce the problems.