I've moved my blog to!. Please update your links. This blog is no longer in use--you can find all posts and comments at my new blog; I will no longer be posting to this site and comments have been disabled.

Thursday, August 9, 2007

Self Service Site Creation

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.

   1: SPWebApplication wa = SPWebApplication.Lookup(new Uri(url));
   3: if (enabledProvided)
   4:  wa.SelfServiceSiteCreationEnabled = enabled;
   5: if (requireContactProvided)
   6:  wa.RequireContactForSelfServiceSiteCreation = requireSecondaryContact;
   8: wa.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.

        -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

No comments: