
Buildout
283
}
}
});
}
Wrox.SiteProvisioning\Layouts\Wrox.SiteProvisioning\SiteRequests.aspx.cs
Finally, you’ve reached the heart of the solution. The preceding code provisions a new site collection
given a site request list item object. Although the function appears to be long, much of the length is
due to logging and status updates. Step by step, this function performs the following:
Retrieves the conguration list item for the given site type
Builds the new site’s full URL
Locates the web application where that site will be created
Determines the site owner and required features to activate
Creates the site collection
Provisions security groups
The step to provision security groups is necessary because site collections created
via the object model do not have default security groups created automatically.
Enables required site and web scoped features
Creates a new list item in the Created Sites list, used to keep tracks of successfully provi-
sioned sites
Updates the status of the site request list item
Calling the Provisioning Code
Depending on the security conguration of your farm, this code may be run from a number of
places. You could invoke this functionality from within the custom form itself (upon approval
or save if approval is not required), from an event handler, from a timer job, from a web ser-
vice, from a workow, or even from a custom service application. ...