Hi ,
I am able to fire an Event using an Event receiver which I created using Visual Studio 2010 . But instead of firing once, it fires twice. I tried to debug the code and I saw that the was getting executed twice. Is there any particular reason that this is executing in such a manner?

Priyaranjan K SPosted Oct 21, 2015, 4:16 AM
Great work Supreeth . It could have been that the old feature was attached twice to the list .
Thanks,
Supreeth JPosted Oct 21, 2015, 2:13 AM
Supreeth JPosted Oct 15, 2015, 5:31 AM
Rupali ShindePosted Oct 15, 2015, 4:39 AM
Supreeth JPosted Oct 15, 2015, 4:31 AM
Priyaranjan K SPosted Oct 15, 2015, 3:08 AM
Supreeth JPosted Oct 15, 2015, 3:01 AM
Priyaranjan K SPosted Oct 15, 2015, 2:35 AM
Supreeth JPosted Oct 15, 2015, 2:17 AM
Rupali ShindePosted Oct 14, 2015, 8:16 AM
Supreeth JPosted Oct 14, 2015, 4:15 AM
Priyaranjan K SPosted Oct 14, 2015, 2:17 AM
Supreeth JPosted Oct 13, 2015, 7:17 AM
Priyaranjan K SPosted Oct 13, 2015, 6:32 AM
Supreeth JPosted Oct 13, 2015, 5:55 AM
Priyaranjan K SPosted Oct 13, 2015, 5:13 AM
Supreeth,
I will give you couple of inputs anyway :
1. If your ER is trying to catch the document upload event and the library has Requires Check out option enabled then the ER will fire twice . This is the default behavior in SP .
Workaround
•Click on a list in the left navigation menu (or otherwise get into a list)
•Click the Library tab in the Ribbon
•Click Library Settings button in the Library Tab
•This will take you to the list information screen
•Click the Versioning settings link
•The Require Check Out radio button should appear in the list of settings
2.Disable Event Firing in code .
this.EventFiringEnabled = false;
item.Update();
this.EventFiringEnabled = true;
3.Sometimes ER are registered twice .Use the Powershell to find that out :
Run the below powershell script to see if the event receivers are attached or not. If they are attached multiple times, just delete them using a powershell.
Check Event receivers using powershell:-
Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$spWeb = Get-SPWeb -Identity "sitename"
$spList = $spWeb.Lists["yourlistname"]
$spList.EventReceivers | Select assembly,name
Replace "sitename" with your site url and "yourlistname" with list name.
Once you confirm the event receivers, use below to delete them
Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$spWeb = Get-SPWeb -Identity "your site url"
$spList = $spWeb.Lists["TrackTravel"]
$evts = $spList.EventReceivers | where {$_.Assembly -eq ""your assembly"}
$evts
if ($evts.Count -gt 0) {
foreach ($evt in $evts) {
Write-Host("Deleting..." + $spList.RootFolder.ServerRelativeUrl + ", " + $evt.Type)
$evt.Delete()
}
}
Once you run this, you can now redeploy your solution.
Thanks,
If you found this useful Please mark this as Answer
Priyaranjan K SPosted Oct 13, 2015, 4:50 AM
Hi Supreeth,
What is the type of the ER you are running . Is is it on an item or some other SP object ? Is it an Asynchronous one or a Synchronous one ?Please specify the event you are trying to catch