If you are writing an event handler on list or library it will prompt for select the list type.
If you select announcements, tasks or any custom list. Generally it will run on the lists which have the same template id.
To avoid Event handlers to running on all the lists of similar template ids
Go to Elements.XML file of the event receiver
When you create Event Receivers in your solution in Visual studio you will have the following line added
Template id will be different type for different type of lists.
But our scenario is list template id is same but we need to run on particular list, so we need to replace that line with below line.
This directs the event receiver to respond only to events that occur in the Customlist. You can change the ListURL attribute to reference any list instance on the SharePoint server.
Asked In: Many Interviews |