1

I have created an ItemAdded event receiver that is supposed to process new documents/files after they've been added to any document library in the farm - i.e., I'd like the event receiver to automatically monitor all document libraries across the farm, both already existing and those that will be created in the future.

The problem is, if I set the event receiver feature scope to "Farm", I get an error in VS2010 when I try to deploy:

The Project Item cannot be deployed through a Feature with Farm scope.

How can I deploy event receiver for the entire farm, if possible at all? (Because if it isn't possible, that pretty much renders the entire concept of event receivers useless to me...).

1
  • @KarthikJaganathan I have seen this question, but I don't understand the solution, nor if it applies here?
    – w128
    Mar 26, 2014 at 10:27

1 Answer 1

1

The Event Receivers can only be Scope at Site or Web. http://msdn.microsoft.com/en-us/library/office/ms431081(v=office.14).aspx

I believe you would need to use a Feature Stapler.

For existing sites, you will need to activate the feature manually, either using the UI, or powershell loop that activates the feature everywhere.

Then you need a feature Stapler to add this feature to each site template, so that any future sites that will be created this feature will be activated on it.

Try reading my blog first before attempting to do a feature Stapler. http://cann0nf0dder.wordpress.com/2013/10/08/my-feature-stapler-doesnt-work-what-to-do/

2
  • Thank you, so this seems to be the only way... Do you perhaps know why Event Receivers are limited to Site/Web scope? It seems a very arbitrary design decision to me.
    – w128
    Mar 26, 2014 at 10:31
  • Unfortunately I don't know why it's only Site/Web scoped. It could be because you can only deploy lists/libraries templates and instances at Site/Web scopes. msdn.microsoft.com/en-us/library/ms469947.aspx Mar 26, 2014 at 10:33

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