Since the advent of free SharePoint Designer (SPD) downloads, many of us have wondered how to block users from using SPD on some SharePoint sites.While this may fly in the face of empowering your users, there are some (maybe a lot?) of sites that you just don’t want anyone to mess with.SPD can be a powerful tool, and in the wrong hands it can lead to way too many support tickets and site admin headaches.
If you’ve been lucky enough to get to try to resolve this, you’ve no doubt already read the guidance from the SPD Team at MS, and if you’re anything like me you found the solutions it presents less than perfect for your scenario.
Luckily there’s another solution available to SharePoint developers that’s making its way around the web, with a great example found on CodePlex by iwkid.Basically there’s a property that can be set in an SPWeb property bag, and that will block SPD from accessing your site.
The critical lines of code are:
spWeb.AllProperties.Add(“vti_disablewebdesignfeatures2”, “wdfopensite”);
spWeb.Update();
I’ll spare you all the implementation details – suffice it to say just get a handle on an SPWeb object, set the property, then update the SPWeb object.You can use what’s in the CodePlex solution or you can use this code sample to roll your own.You can create a utility exe to run thru your entire site collection, create an administration web part to turn SPD access on or off to a particular site (or a bunch of sites at once), or like in the CodePlex example create a Site Feature that can be turned on or off. Or anything else you can do in code – options are endless.
This solution was a life saver, and has worked out very nicely.We decided to implement it as a Site Feature – using the CodePlex solution as a starting point – allowing site admins to decide whether to grant or deny access.So far so good, we have not noticed any impact on any other functionality – InfoPath forms still work, which was the downfall of a previous solution we had tried.
Another thing I love about this solution – SPD gives a friendly little message to the user when they try to open a blocked site:
“The web site has been configured to disallow editing with SharePoint Designer.Contact your web site administrator for more information.”
Nice.