SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a site definition but i need to limit what sub sites can be created by the user.

How can I do this with SharePoint 2010?


share|improve this question
We are not using the publishing feature. How can we limit the list of templates that are listed for creating sub sites? – dave Oct 27 '10 at 17:26

As part of the publishing features you can add AvailableWebTemplates and AvailablePageLayouts declaratively as feature properties in onet.xml:

<Feature ID="22A9EF51-737B-4ff2-9346-694633FE4416">    <!-- Publishing -->    <Properties xmlns="">
<Property Key="AvailableWebTemplates" Value="*-BLANKINTERNET#1;*-BLANKINTERNET#2"/>
<Property Key="AvailablePageLayouts" Value="~SiteCollection/_catalogs/masterpage/ArticleLeft.aspx:~SiteCollection/_catalogs/masterpage/ArticleLinks.aspx:~SiteCollection/_catalogs/masterpage/ArticleRight.aspx"/>

The * can be replaced with a specific LCID (eg 1033) if you only want the template available for specific languages. Seperator is ; for templates and : for page layouts

share|improve this answer
Can this be done without turning on the publishing features? – dave Oct 27 '10 at 17:23
SPWeb.SetAvailableWebTemplates() is what you are looking for. Filter on LCID to only allow templates for specific languages. Also remember to call update on SPweb after setting the allowed templates. – Anders Rask Oct 29 '10 at 22:13

I would like to know if there is a declarative way to do it. But you can have a feature activtaed which receives following event whenever a new web is being created. You will have an opportunity to check for allowed templates and then redirect the users to error page if needed.

public override void WebAdding(SPWebEventProperties properties) { // Check properties.Web.WebTemplate belongs to the allowed templates... and if not do following

properties.Cancel = true; properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl; properties.RedirectUrl = "/_layouts/Custom/error.aspx"; }

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.