Friday, June 5, 2009

Site Definition with subwebs

Scenario:
My good friend Shishir asked me a way to create sub-webs from the site definition.He knows it that I say its not possible in very rare situations :-)

parentChild.xml( 12/TEMPLATE/XML):

<?xml version="1.0" encoding="utf-8" ?>
<portal xmlns="PortalTemplate.xsd">
    <web name="Parent" 
         siteDefinition="STS#0" displayName="Parent" description="This is parent web" >
        <webs>
            <web name="Child" 
                siteDefinition="sts#1" 
                displayName="Child" 
                description="I am kid" />
        </webs>
    </web>
</portal>
webtemp.parentchild.xml(12/TEMPLATE/1033/XML):
<?xml version="1.0" encoding="utf-8"?>
<!-- _lcid="1033" _version="12.0.4518" _dal="1" -->
<!-- _LocalBinding -->
<Templates xmlns:ows="Microsoft SharePoint">
 <Template Name="ParentChildSTS" ID="5200">
    <Configuration ID="0" Title="ParentChild" Hidden="FALSE" ImageUrl="/_layouts/1033/images/sts.gif" Description="This is parent child configuration"
        ProvisionAssembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"       ProvisionClass="Microsoft.SharePoint.Publishing.PortalProvisioningProvider"
        ProvisionData="xml\\parentchild.xml" DisplayCategory="Custom" >
    </Configuration>
 </Template>
</Templates>
Note:
-- You are using it in MOSS environment because the binary referenced below is part of MOSS.
-- Make a copy of STS folder in the same location and rename it to ParentChildSTS. This will act as you new site. If you have own site definition please make necessary changes.
-- IISReset is required after the configuration
-- This is tested method :-)

Follow on Twitter

0 comments: