I have created a sandbox solution in which there is one feature for creating two sub-sites. In the event receiver of that feature I have created two sites programmatically.
The code is as per below:
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
try
{
SPWeb currentWeb = properties.Feature.Parent as SPWeb;
currentWeb.Webs.Add("Blog", "Blogs", "", (uint)1033, "BLOG#0", false, false);
currentWeb.Webs.Add("COMMUNITY", "Community", "", (uint)1033, "COMMUNITY#0", false, false);
}
catch (Exception ex)
{
}
finally
{ }
The feature is placed in the web template, under <WebFeatures>
. But after creating site from the web template sometimes sub sites are created and sometimes not created.
What am I missing?