I have a SharePoint 2013 site with multiple lists. Many of the lists have a common content type. We have created custom event receivers to be attached to these lists. But since we want the same event receivers to be attached to these multiple lists, we were attaching it to the content type and not explicitly to a specific list.
So, we removed the ListTemplateID
and ListUrl
attributes from the Receivers
tag in the xml. But because of this, I observed through SharePoint Manager that these event receivers are getting registered at the site level (same the scope of the project containing the event receivers), instead of getting attached to the content types / lists and hence they are firing for every list. This behaviour is, as per the MSDN documentation. But now, I have the following questions.
Is it possible to attach a common event receiver to a set of lists (not based on Template ID) or content types?
When we simply try to attach the event receivers to the content type, is it possible to ensure that the event receiver fires only for the intended lists/content types and not for every list in the site?