SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)

share|improve this question

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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