Hi,
I have a parent website under which i want to create subsites on the fly using visual studio 2010.
The subsites which i want to create have a common stuructre(in temrs of lists & custom).
So i saved the template in sharepoint 2010,it becomes wsp and goes into soution gallery.
Now how do i use this template say mytemplate.wsp,to create site in visual studio.
i tried this
using (SPSite site = new SPSite ("http://infml01132:5566/sites/VRND " ))
{
using (SPWeb web = site.OpenWeb())
{
SPWebTemplateCollection myTemplates = site.GetCustomWebTemplates(Convert .ToUInt32(web.Locale.LCID));
//SPWebTemplateCollection temlates1 = site.GetCustomWebTemplates(1033);
//SPWebTemplateCollection temlates = site.GetWebTemplates(1033);
//SPCustomWebTemplate
SPWebTemplate subsitetemplate = myTemplates["vrndtmpl" ];
web.Webs.Add("subsite1" , "rnd subsite1" , "subsite description changed" , Convert .ToUInt16(1033), subsitetemplate, false , false );
}
}
But i dont get my template in mytemplates collection.
Thanks