Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am using sharepoint 2010 and vs2010.

I created a custom web template and start with the onet.xml from the teamsite. I see 4 configuration sections. Why there are more then 1 configuration sections? Is it possible to select one of them in sharepoint?

    <Configurations>
    <Configuration ID="-1" Name="NewWeb" MasterUrl="_catalogs/masterpage/v4.master" />
    <Configuration ID="0" Name="Default" MasterUrl="_catalogs/masterpage/v4.master">
some stuff
</Configuration>

 <Configuration ID="1" Name="Blank" MasterUrl="_catalogs/masterpage/v4.master">
some stuff
</Configuration>

<Configuration ID="2" Name="DWS" MasterUrl="_catalogs/masterpage/v4.master">
some stuff
</Configuration>

</Configurations>

I see also differance module element related to the configuration:

<Modules>
    <Module Name="Default" Url="" Path="">
      <File Url="default.aspx" NavBarHome="True">
        <View List="$Resources:core,lists_Folder;/$Resources:core,announce_Folder;" BaseViewID="0" MobileView="TRUE" WebPartZoneID="Left" />
        <View List="$Resources:core,lists_Folder;/$Resources:core,calendar_Folder;" BaseViewID="0" MobileView="TRUE" RecurrenceRowset="TRUE" WebPartZoneID="Left" WebPartOrder="2" />
        <View List="$Resources:core,lists_Folder;/$Resources:core,links_Folder;" BaseViewID="0" MobileView="TRUE" WebPartZoneID="Right" WebPartOrder="1" />
        <NavBarPage Name="$Resources:core,nav_Home;" Url="~site" ID="1002" Position="Start" />
        <NavBarPage Name="$Resources:core,nav_Home;" Url="" ID="0" Position="Start" />
      </File>
    </Module>
    <Module Name="DefaultBlank" Url="" Path="">
      <File Url="default.aspx" NavBarHome="True" Type="Ghostable">
        <View List="$Resources:core,lists_Folder;/$Resources:core,announce_Folder;" BaseViewID="0" MobileView="TRUE" WebPartZoneID="Left" />
        <View List="$Resources:core,lists_Folder;/$Resources:core,calendar_Folder;" BaseViewID="0" MobileView="TRUE" RecurrenceRowset="TRUE" WebPartZoneID="Left" WebPartOrder="2" />
        <View List="$Resources:core,lists_Folder;/$Resources:core,links_Folder;" BaseViewID="0" MobileView="TRUE" WebPartZoneID="Right" WebPartOrder="1" />
        <NavBarPage Name="$Resources:core,nav_Home;" Url="~site" ID="1002" Position="Start" />
        <NavBarPage Name="$Resources:core,nav_Home;" Url="" ID="0" Position="Start" />
      </File>
    </Module>
    <Module Name="DWS" Url="">
      <File Url="defaultdws.aspx" Name="default.aspx">
        <View List="$Resources:core,lists_Folder;/$Resources:core,announce_Folder;" BaseViewID="0" WebPartZoneID="Top" />
        <View List="$Resources:core,lists_Folder;/$Resources:core,links_Folder;" BaseViewID="0" WebPartZoneID="Right" WebPartOrder="2" />
        <View List="$Resources:core,shareddocuments_Folder;" BaseViewID="1" WebPartZoneID="Left" />
        <View List="$Resources:core,lists_Folder;/$Resources:core,tasks_Folder;" BaseViewID="7" WebPartZoneID="Left" WebPartOrder="2" />
        <AllUsersWebPart WebPartZoneID="Right" WebPartOrder="1">
          <![CDATA[
                   <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
                      <Assembly>Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
                      <TypeName>Microsoft.SharePoint.WebPartPages.MembersWebPart</TypeName>
                      <Title>$Resources:wp_Members;</Title>
                      <Description>$Resources:wp_Members_Desc;</Description>
                      <FrameType>Standard</FrameType>
                      <IsVisible>true</IsVisible>
                      </WebPart>
                   ]]>
        </AllUsersWebPart>
        <NavBarPage Name="$Resources:core,nav_Home;" Url="~site" ID="1002" Position="Start" />
        <NavBarPage Name="$Resources:core,nav_Home;" ID="0" Position="Start" />
      </File>
    </Module>
  </Modules>
share|improve this question

1 Answer 1

yes, You can have a site definition with more then 1 configuration, and you can use one of them to create a site,

for example, when we try to create a site we give web template name its configuration ID,

Let say you got a site definition with two configuration, 1 and 0,

STS#0        Team Site
STS#1        Blank Site

You can create a Team site by using this code,

admService.CreateSite("http://Server_Name/sites/SiteCollection_Name",
        "Title", "Description", 1033, "STS#0", 
        "Domain_Name\\User_Alias","User_Display_Name",
        "User_E-mail","","");

Options like Module and Configuration are there so that you can create a different sites with different components and layouts and even properties of components without creating different site definitions.

Still Confused ?

enter image description here

This diagram should clear all of your confusions with site definitions if not then,

How to: Use Site Definition Configurations

Edit

Each configuration has a attribute "Title" which can be used to create sites based on configurations.

share|improve this answer
1  
Jeez where'd you find that screenshot of SPS2003? Haven't seen that one for about 6 years now! –  James Love Mar 29 '13 at 13:59
    
1  
Maaannn.. it's like seeing photos of yourself from preschool! –  James Love Mar 29 '13 at 14:06
    
Haha, I know what you mean, I was always confused with site definitions and web templates and then I came across this picture, it actually cleared my concepts like crystal, very useful :D –  Muhammad Raja Mar 29 '13 at 14:06
    
ok, but when I dont create a new site programmatically. Just the normal way, site actions -> create new site. Which configuration will be used? –  KHA Mar 29 '13 at 14:11

Your Answer

 
discard

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.