0

I have an environment in which we have 1000's of site collection. We also create new site collection.

I want to deploy an event receiver which is available across all the site collections i.e web apllication.

I created a new solution and added event receiver to it. I deployed it at the root site collection with scope set as Site. The solution is only available in that particular site collection. I am not allowed to set the scope to WebApplication as i get the error message as :

The Project Item "SetAlstomMP" cannot be deployed through a Feature with WebApplication scope. c:\users\133386\documents\visual studio 2010\Projects\TeamSite-SubSites\TeamSite-SubSites\Features\Feature1\Feature1.feature TeamSite-SubSites

My basic requirement is that i want each of the subsite created in a site collection to inherit Master Page from the parent site. For which i was planning to write an event receiver.

Also, when new site collection is created i want the solution to be auto activated. Is this possible?

Can anyone please suggest if this is a correct approach? and how do i go ahead with the deployment?

1 Answer 1

1

The Site scoped feature will be available for all site collections in the web application. If you want your feature to appear in all sub sites under site collection, then you should change the Scope to Web.

If you want your master page to be automatically set in the sub sites under a root site collection you can use SPWebEventReceiver.WebProvisioned event.

Synchronous After event that fires after a subsite is fully provisioned and the provisioning process has stopped, but does not fire when the root web site of a new site collection is created.

In order to activate the feature automatically on new site collection creation, you can add the Site scoped feature in SiteFeatures collection of site definition file named ONET.xml file, if you have custom site difintion. However, in case of OOB site definition, you can use feature stapling

4
  • I am working on WebProvisioned, but as you mentioned a Site scoped feature will be available for all site collections, but that is exactly what is not happening. I have deployed the solution at the root site e.g http://server02:2000/ and the solution is available in Site Collection feature but if i naviagete to http://server02:2000/sites/a then the feature is not available.
    – Ishan
    Mar 23, 2015 at 10:32
  • @Ishan, ar you sure you are checking the feature at right location. It shoud be in Site Settings -> Site Collection administration -> Site Collection features Mar 23, 2015 at 11:36
  • Yes absolutely.. I checked in Site Collection feature and even manage site features (just incase).. i didn't find the feature..
    – Ishan
    Mar 23, 2015 at 13:06
  • i have deployed using VS, providing the URL as http://server02:2000/
    – Ishan
    Mar 23, 2015 at 14:01

Your Answer

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

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