views:

48

answers:

1

Hi,

I'm adding ItemAdding event receiver for custom list template. Both event receiver and list template are deployed by the same feature. Also the same feature creates List Instances.

The problem I've got is that the event is fired for each list item in site to which it was deployed. Elements.xml for eventreceivre is:

<Receivers ListTemplateId="10200">
  <Receiver>
    <Name>ListEventReceiverItemAdding</Name>
    <Type>ItemAdding</Type>
    <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
    <Class>SharepoitProject.ListEventReceiver</Class>
    <SequenceNumber>10000</SequenceNumber>
  </Receiver>
</Receivers>

I'm not sure what I'm doing wrong I've done more or less everythin from here.

Env: Sharepoint 2010 with Publishing Feature on this Site

A: 

From the MSDN SDK - http://msdn.microsoft.com/en-us/library/ms431081.aspx


A Receivers tag can imply a site-wide event registration or an event registration for the root Web. The Scope attribute is used to define at what level the event receivers are applied. If the Receivers tag has no ListTemplateId or ListUrl attribute, the event receiver is registered at the same scope as the Feature. For example, a Feature that is scoped to the Web results in an event receiver being added to an event receiver collection that is scoped to the Web.


This leads me to believe that the list templateID you supplied may be invalid.

brian brinley