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
In my case it was accidentally doubled registration of event reciever. Check it with SharePoint Manager 2010 for example.
-
Hi Alex, could u tell me how can i check if the event receiver has been double registered in the sharepoint manager?– SandeshRCommented 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. 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..– SandeshRCommented Feb 14, 2012 at 21:41
Before you call update on the item in your receiver, are you calling this.DisableEventFiring()
and then this.EnableEventFiring()
straight after?
-
Hi James, i am not calling any of those?...do u have to mention them?– SandeshRCommented Feb 14, 2012 at 19:39
-
2If 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
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.
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.