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 want to make 3 lists in root site & 2 subsites under the root site.

As soon as I create subsites from portal.xml my 3 lists are not showing.

share|improve this question
Do you have features which create your lists? What the scope of these fetures is? – Andrew Adamich Mar 12 '13 at 13:22
I have features on Site level. – Harsh Bhavsar Mar 13 '13 at 3:52

Go to site settings and choose "add an app". Then select a list type.

For creating sub site , you have to choose "add a page" in site settings.

share|improve this answer
I am creating it in Visual Studio.Not Manually. – Harsh Bhavsar Mar 12 '13 at 12:18

I suppose you have a site template in your site definition onet.xml,

To be able to create lists in the site definition you should activate your features creating lists in your site template definition w

To activate feature on the root site in the template you apply to your root site in the section "SiteFeatures" you should call feature activating. This should be similar to this:

<Configuration ID="99" Name="TemplateName" Title="Site title">
     <Lists />
       <!-- Your feature creating lists on root web-->
       <Feature ID="C85E5759-F323-4EFB-B548-443D2216EFB5" />
       <Module Name="Root" />

Note that it is best to create separate template for your sub site with different ID and activate features for web level in this template which will be applied to sub site.

Hope it helps,

If you have more question...


share|improve this answer
I am doing the same thing but I am not able to make subsite & list simultaneously in one sitedefinition. – Harsh Bhavsar Mar 14 '13 at 4:33
You site definition contains (as it says) definitions of the site (templates). You should create create minimum two templates - one for root web and the other for your subsites. When create your root site - apply root site template. When craete subsite - apply subsite template. As your lists should be created on root site - activate list feature in the "SiteFeatures" section while on the subsite template you do not have to do this. – Andrew Adamich Mar 14 '13 at 7:48
I want to make lists & subsite on the root site. – Harsh Bhavsar Mar 14 '13 at 8:42
How do you create your subsites? Inside the sitedefinition? External script? – Andrew Adamich Mar 14 '13 at 9:19
<portal xmlns="PortalTemplate.xsd">in subsite.xml & ref that file in provision data in webtemp file. – Harsh Bhavsar Mar 14 '13 at 9:23
up vote 0 down vote accepted

Done by adding feature & write following code in feature.EventReceiver file

public override void FeatureActivated(SPFeatureReceiverProperties properties)
    SPSite site = properties.Feature.Parent as SPSite;
    site.RootWeb.Webs.Add("Subsite", "Sub site", "Description", 1033, "Template#0",true, false); 
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.