Visual Studio SharePoint Event Receiver SPI Bugs

Visual Studio SharePoint Event Receiver SPI Bugs

I have been doing a fair amount of SharePoint 2010 development recently, a lot of this with event receivers. The new SPI (SharePoint Item) functionality in VS2010 is great and long gone are the days of creating Elements xml files manually.

Although it isn’t all sunshine and roses as I have discovered!

I have been experiencing issues when creating Item and List event receivers. My List event receivers seem to fire for every list on the site and the Item event receivers fire for each item in each list on the site.

As I understand it the <Recievers> element in the Elements.xml of the event receiver SPI has a handful of attributes to allow you define which list the event receiver should run for, these are as follows:

  • ListTemplateId
  • ListTemplateOwner (Feature ID that contains the list in question)
  • ListUrl (Url of the list)
  • RootWebOnly
  • Scope (Site, Web etc)

However setting these attributes does not seem to make any difference – the event receivers still fire for any list/item etc!

Here is an example of the xml I have tried:

[code lang="xml"]<Receivers ListUrl="/Lists/MyList" ListTemplateId="99100" ListTemplateOwner="{12ED7E89-7837-47A0-A71B-4837DA540751}"></Receivers> [/code]

I have a question posted about this issue over at SharePoint Overflow – please check it out and if you have seen this behaviour before then please let me know.

Thanks Smile

4 thoughts on “Visual Studio SharePoint Event Receiver SPI Bugs

  1. Roberto

    I was having the same issue. The problem was the Feature was scoped to Site collection which causes the event to be triggered for all the lists. This is clearly a bug on SharePoint.

    1. Alex

      Hi Roberto,

      Glad to hear its not just me who’s having the issue – mine was scoped to Site Collection also. Did you manage to fix the issue at all? or is it definitely a bug?


  2. Andi

    I know this is an old post but I had the same problem.

    There wereTwo things that got me.

    First, the ListUrl element must not start with a /

    – Wrong
    – Correct

    Took me ages to spot it!!!

    Second, the event handler need to be in a feature that has a scope of Web. It will then fire on the specified list.

    If the feature is scoped at Site then it fires on all the lists.

    Hope this helps


    1. Alex Post author

      Hi Andi,

      Glad to hear you got it sorted, will have to check this myself as it’s been a while. Will let you know how I got on.



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">