I have build an event receiver that perform some job when a new item is created.
The event should be fired on a specific list type which is defined in the same solution.
However, the event receiver also fires for list type, with the same TemplateID of other solution.
Here is my receiver subscription :
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Receivers ListTemplateId="10000"
ListTemplateOwner="fde2b1cc-51e1-4654-b754-addcb571ce12">
<Receiver>
<Name>MyEventReceiverItemAdded</Name>
<Type>ItemAdded</Type>
<Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
<Class>MyProjecT.MyReceiverClass</Class>
<SequenceNumber>10000</SequenceNumber>
</Receiver>
</Receivers>
</Elements>
I specified in the ListTemplateOwner attribute the ID of the feature who created the list (via a <ListInstance>
node).
But the event fires for another list, defined in another solution, with the same ListTemplateID. I can change the template ID, but I can't guarantee that someday, someone else create a new list template with the same ID (10000 is the default value with VS).
What is the correct way of subscribing an event receiver to a specific kind of list?