Self Service Site Creation

Posted on Posted in SharePoint 2007, STSADM Commands

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));
   2:  
   3: if (enabledProvided)
   4:  wa.SelfServiceSiteCreationEnabled = enabled;
   5: if (requireContactProvided)
   6:  wa.RequireContactForSelfServiceSiteCreation = requireSecondaryContact;
   7:  
   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.

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

2 thoughts on “Self Service Site Creation

  1. Hi,

    Thanks for your help. It helped me a lot. i was actually struggling a lot in creating a personal site programatically. i look at you code and tried to implement this before creating personal site but it gives me an error access denied. can you please help me in this.

    my code looks like this:
    if(userprofile.createpersonalsite==null)
    {
    spwebapplication spWa=spwebapplication.lookup(new uri(mysiteHostUrl));
    spWa.SelfServiceSiteCreationEnabled=true; ——> access denied error throws at this line
    spWa.Update();
    userprofile.createpersonalsite();

    }

    Thanks,

Leave a Reply

Your email address will not be published. Required fields are marked *

*