I have a code from external developer that creates site in list event receiver.
public override void ItemAdded(SPItemEventProperties properties)
{
bool EventFiringEnabledStatus = EventFiringEnabled;
ReceiverParams param = new ReceiverParams(properties);
EventFiringEnabled = false;
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(properties.SiteId))
{
using (SPWeb web = site.OpenWeb(properties.Web.ID))
{
if (!IsWebExists(web, name))
{
bool allowUnsafeUpdates = web.AllowUnsafeUpdates;
try
{
web.AllowUnsafeUpdates = true;
SPWebCollection collection = web.Webs;
SPWeb projectWeb = collection.Add(name, title, description, culture_LCID, templateName, true, false);
projectWeb.Update();
isCreated = true;
}
finally
{
web.AllowUnsafeUpdates = allowUnsafeUpdates;
}
}
}
}
});
}
finally
{
EventFiringEnabled = EventFiringEnabledStatus;
}
}
I want to customize the site using WebProvisioned event receiver:
public override void WebProvisioned(SPWebEventProperties properties)
{
System.Diagnostics.Debugger.Break();
base.WebProvisioned(properties);
}
This event fires when i create site from web interface or from my own code. But it does not fires when the site is created in list event receiver. There is only "Error loading and running event receiver : Thread was being aborted." in logs.