I am creating a SharePoint site from code behind using SharePoint object model. In the WebProvisioned event, I am creating the groups, enabling a few features. Everything is working fine, except the WebProvisioned event is firing twice. This only happening if I try to create the site using Object model, if a site is created using "New Site" option from UI, it is only firing once. I found a few article mentioning that when a site is created using object model the WebProvisioned event will be called twice, not sure why though.
Also, if I change the scope of the event receiver to "Web", WebProvisioned is called only once. But, I need this scoped at "Site" level.
Can you please tell me a work around at least?
Below are the articles I found,
The second article says we can set the
properties.cancel=true, so that it will cancel the event. But, I need to do it only when the event is being fired for the second time. Is there any way to do that? I couldn't find a way to do that.