Our company loves to co-locate services. Source control, production servers, HR, you name it, if we can get it out of the building, we do it. So it comes as no surprise that our document management/repository exists out on the internet hosted by a service provider using Microsoft SharePoint.
A very irksome issue with SharePoint and Vista is that for many people SharePoint shares aren’t accessible as mappable network drives or through the common dialog for opening/saving files in Office 2007. People upgrading from Windows XP find they suddenly just cannot access their previously mapped and usable SharePoint shares. This problem occurs when you use Vista and attempt to map to a share across http because Vista, coming configured for a much more stringent security model, doesn’t do WebDAV over http, only https. If you are having issues with a Windows 2008 server connecting to a SharePoint (or WebDAV) share over http I would imagine the solution below will work for you as well. (And yes, SharePoint or WebDAV over http is probably a silly idea in the first place… obviously if its within your power to https-ify the share that’s likely the best solution – even if its via a self-signed cert). (Update: Windows Server 2003 instructions appear below.)
(I ran across a lot of people having this problem, some solutions to similar problems, but the most informative source was a post I found in Robert McMurray’s blog.)
- Fire up regedit.exe (if UAC is enabled you’ll have to approve it of course)
- Navigate to the key HKEY_LOCAL_MACHINE\
- Change the setting BasicAuthLevel from its current value (default 1) to 2 (0 means disabled, 1 is https only, 2 is both http and https)
- Optional. Change the setting ServerNotFoundCacheLifeTimeInSec from its current value (default 60) to 0 (change from hexadecimal to decimal) (I made this change just because I had been hammering on a box trying to fix the issue, I didn’t want a cache issue to be my undoing)
- Right-click a shortcut to cmd.exe and choose Run As Administrator (or just fire up cmd.exe if you have disabled UAC)
- Enter the following commands:
- net stop webclient
- net start webclient
- net use x: “http://yoursharepointprovider.tld/somesharename” /user:”whateverdomain\yourusername” /persistent:yes
- Enter your password when prompted
The net use command is optional, you can map using the Windows Map Network Drive functionality or even open the share using the common file dialog in Office.
Note that this solution does not fix the fact that with most shared SharePoint hosting providers you cannot map to the root share (that is, http://yoursharepointprovider.tld); you must choose a share. There are ways around this if you have access to the IIS instance hosting SharePoint but since that wasn’t my problem I did not explore them.
And yes, what this means is that if you are automating uploading files to SharePoint you don’t have to use the SharePoint web service API or the SharePoint SDK to perform such a simple task – you can just use File.Copy and away you go!
For Windows 2003 server the DWORD value you must add to the registry under the Parameters key above is UseBasicAuth and set its value to 1 and you’ll also want to update the AcceptOfficeAndTahoeServers key from 0 to 1. You cannot just net stop/start webclient; instead you must net stop mrxdav then net start webclient. Finally, and this is important if you are using things such as “%20″ to represent spaces in your folder names – don’t; instead just use spaces or the equivalent character. I found this out from KB841215.
For Windows 2008 and Windows 2008R2 you may find the WebClient key is absent from the registry. You can add it by adding the “Desktop Experience” feature (follow the instructions for “Installing the WebDAV Redirectory” under the heading “Windows Server 2008 or Windows Server 2008 R2″ at http://learn.iis.net/page.aspx/386/using-the-webdav-redirector/ – you do not necessarily need to install the WebDAV Redirector though by doing so you probably don’t have to perform any of the above steps manually). Once you reboot you will have the WebClient registry key. You will probably also want to change the WebClient service startup from Manual to Automatic.