I am programmatically trying to create a new site and apply the "Team Site" template.
If you do this through the SharePoint UI, the site is created with various lists in the template. However if I run the code sample below, a blank site is created - no lists, tasks etc.
It seems that the template is not being applied or I am specifying it incorrectly.
using (SPSite siteCollection = new SPSite("http://server/"))
SPWebTemplateCollection templates = siteCollection.GetWebTemplates(1033);
SPWebTemplate template = templates["STS#1"]; //Team Site
using (SPWeb web = siteCollection.OpenWeb())
SPWeb newWeb = web.Webs.Add("TeamSite1", "This is a team site", "", 1033, template, false, false);
Further code samples can be seen on MSDN
Any help is much appreciated.