Answered by:
My Sharepoint item adding, item added, item updating,item updated event handler is firing twice

Question
-
Hi,
Iam using custom permissions/groups for the lists in my site.
In the receivers i am using hashtable with key as list name and value as group name.like below
public override void ItemAdding(SPItemEventProperties properties)
{Hashtable ht = new Hashtable();
ht["Students"] = "Student Members";
ht["Employee"] = "Employee Members";foreach (DictionaryEntry de in ht)
{
if (properties.ListTitle == de.Key.ToString())
{
//logic for email
}}
}
Not sure why my event handler is executing twice..Can some please help on this issue?
Thanks
Usha
- Changed type Hemendra Agrawal Thursday, June 27, 2013 5:02 AM q
Tuesday, June 25, 2013 3:27 PM
Answers
-
That's probably because the event receivers are getting attached to every list other than the required one. See if this link helps - http://blog.krichie.com/2011/05/18/eventreceiver-firing-twice-dont-make-this-bone-headed-mistake/
Whenever you see a reply and if you think is helpful, click "Vote As Helpful"! And whenever you see a reply being an answer to the question of the thread, click "Mark As Answer Feel free to unmark answer if does not resolves your problem.
- Marked as answer by Hemendra Agrawal Thursday, July 4, 2013 11:04 AM
Tuesday, June 25, 2013 6:45 PM -
There seems to be TWO eventreceivers attached to your list.
check it by using the powershell script below:
$spWeb = Get-SPWeb -Identity http://server $spList = $spWeb.Lists["My List Name"] $spList.EventReceivers | Select Name,Assembly,Type
you may also use SharePoint Manager http://spm.codeplex.com/downloads/get/526736----------------------- Sharepoint Newbie
- Marked as answer by Hemendra Agrawal Thursday, July 4, 2013 11:04 AM
Wednesday, June 26, 2013 5:06 AM
All replies
-
That's probably because the event receivers are getting attached to every list other than the required one. See if this link helps - http://blog.krichie.com/2011/05/18/eventreceiver-firing-twice-dont-make-this-bone-headed-mistake/
Whenever you see a reply and if you think is helpful, click "Vote As Helpful"! And whenever you see a reply being an answer to the question of the thread, click "Mark As Answer Feel free to unmark answer if does not resolves your problem.
- Marked as answer by Hemendra Agrawal Thursday, July 4, 2013 11:04 AM
Tuesday, June 25, 2013 6:45 PM -
There seems to be TWO eventreceivers attached to your list.
check it by using the powershell script below:
$spWeb = Get-SPWeb -Identity http://server $spList = $spWeb.Lists["My List Name"] $spList.EventReceivers | Select Name,Assembly,Type
you may also use SharePoint Manager http://spm.codeplex.com/downloads/get/526736----------------------- Sharepoint Newbie
- Marked as answer by Hemendra Agrawal Thursday, July 4, 2013 11:04 AM
Wednesday, June 26, 2013 5:06 AM