Well this strikes me as very odd...
I have a VERY simple event receiver, running on ItemAdded, doing actually nothing but log for testing purposes. In the elements.xml it is attached to a specific List template (ListeTemplateId="10002").
My feature to deploy the list and the event receiver is site collection (site) scoped.
Everything deploys fine, but here comes the funny part:
(A workflow is attached to the said list)
After creating a new item in the list, the EventReceiver fires - all good. But it
also fires for the Workflow History + Workflow Task list which have been touched by the workflow.
This seems impossible as I told the EventReceiver to only fire for the list with Template ID 10002... When trying to "find" the deployed EventReceiver via the OM - I cannot find it anywhere. It is actually not attached to the list (list.EventReceivers
is empty besides the workflow event receivers) and it is not listed under SPWeb.EventReceivers. Neither the Workflow History nor the Workflow Task list has any EventReceiver.
The solution: Create a new web scoped feature and deploy the EventReceiver with that one. Outcome: Everything like it should be - the EventReceiver is only firing for the list I specified.
Why is this craziness happening?
View Complete Post