I want to have an event receiver on site collection creation, but it is not available. So as an alternative way i think of writing a custom feature, and associating it with the default publishing site template.

Is that possible?

So that everytime a site collection instance is created (publishig site) my code will execute.

As a note: My aim is; i want to make some initial work when the site collection of my project is created: Like deleting the default coming Press Releases site. (These kind of things can be achieved with custom site definitions or web templates, but i don't want to create custom site definition)

1 Answer 1


You can look at what this article is talking about Here.

So one option is the SpWebProvisioningProvider where you could effect the provisioning of a site and call your code on the site being created directly.

Or you could use a feature stapler that activated you custom feature on site creation and have a feature receiver that gets called on activation, thus calling custom code each time a certain (or all) sites are created.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.