2

Hi I have a event receiver(item adding,item editing,item added), it was working fine before ...now it has started to fire twice...any suggestions?

4 Answers 4

7

In my case it was accidentally doubled registration of event reciever. Check it with SharePoint Manager 2010 for example.

3
  • Hi Alex, could u tell me how can i check if the event receiver has been double registered in the sharepoint manager?
    – SandeshR
    Commented Feb 14, 2012 at 19:42
  • Download SharePoint Manager 2010 (spm.codeplex.com/releases/51438/download/146573) (note! you need first release, NOT v2 alfa!), and check as at this my screenshot: gyazo.com/15c4b2c58844d0e61c62da1a1fc2884d.png. Note the event receivers node.
    – Alex Boev
    Commented Feb 14, 2012 at 19:49
  • Thanks Alex! That was it!... there were multiple registration, i used the sharepoint manager...Thanks guys for possible answers..
    – SandeshR
    Commented Feb 14, 2012 at 21:41
4

Before you call update on the item in your receiver, are you calling this.DisableEventFiring() and then this.EnableEventFiring() straight after?

2
  • Hi James, i am not calling any of those?...do u have to mention them?
    – SandeshR
    Commented Feb 14, 2012 at 19:39
  • 2
    If you are updating your item within your event receiver you would want to use these because otherwise the Update call will trigger another Updating/Updated event to fire. Commented Feb 14, 2012 at 20:15
1

Here's an article on the subject from Simple-Talk - Managing ItemUpdating and ItemUpdated Events Firing Twice in a SharePoint Item Event Receiver. Well worth reading.

1

I had the same problem this week when I wanted to publish a page directly from the "Publish" ribbon button.

My event receiver fired three times in a row. The first time for the check in, The second time for the publication, and the last time to approve it.

What I dit was checking the afterproperties, to see if I will get the correct values. I did not find another solution.

If you are updating your item in the event receiver, than you could try James Love his solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.