For some web applications you’re going to need to have tight controls over who can create sites and who can’t. One simple thing you can do to prevent users from creating sites is to disable self service site creation. This can be done from the central admin tool here: Central Administration > Application Management > Self-service Site Management. You can also do the same thing programmatically by setting the SelfServiceSiteCreationEnabled
and RequireContactForSelfServiceSiteCreation
properties of the SPWebApplication
object.
1SPWebApplication wa = SPWebApplication.Lookup(new Uri(url));
2
3if (enabledProvided)
4 wa.SelfServiceSiteCreationEnabled = enabled;
5if (requireContactProvided)
6 wa.RequireContactForSelfServiceSiteCreation = requireSecondaryContact;
7
8wa.Update();
The syntax of the command I created to accomplish this can be seen below.
C:\>stsadm -help gl-setselfservicesitecreation
stsadm -o gl-setselfservicesitecreation
Sets whether self service site creation is enabled for the web application.
Parameters:
-url <web application>
[-enabled <true|false>]
[-requiresecondarycontact <true|false>]
Here’s an example of how to disable self service site creation:
stsadm –o gl-setselfservicesitecreation –url "http://intranet/" –enabled false