Recently I added some email notification workflows to a SharePoint Custom List to send out status updates each time an item’s status is updated.

No rocket science here, as far as designing the workflow in SPD. However, I did run into one glitch: the end users receiving the email notifications were getting two emails at a time.

After some extensive searching on Google/Bing, here are some articles I found that were helpful, but none of them were thorough enough to help me, being that I have limited knowledge of PowerShell and syntax of SharePoint PS commands.

What I found out is that each SharePoint list has Event Receivers to monitor additions/deletions/changes to list items. Using PS commands, I was able to get a list of these Event Receivers (see image for sample of what kind of the output from PowerShell)


Here’s what I observed:

  • There were two ItemUpdated events
  • I noticed that the versions were different in the Assembly attribute (12, being SP2007, and 14 being SP2010). One additional detail is that this list was a template adapted from a SharePoint 2007 list reimplemented in SharePoint 2010

Here’s a list of the supporting articles I used to fix this issue:

I used script examples from each of those links and ran PS commands directly from front end of my SharePoint 2010 server with the SharePoint 2010 Management Shell.

First few commands were just to get my SharePoint site and store some variables. The key bit of info I needed was the $spList in question, which was my custom list with the workflow triggering twice:

$spWeb = Get-SPWeb -Identity http://mySP2010site/mySP2010SubSite/
$spList = $spWeb.Lists[“MyList”]
$spList.EventReceivers

That last command displays a list of Event Receivers as displayed in the image above.

One article showed the delete command thus:

$spList.EventReceivers[#].Delete()

But I had no idea how the lists were enumerated, so now comes a little bit of trial-and-error. Using that syntax and the ability to pipe in a select query, I ran this line incrementally starting at 0 until I found the list in question. I used the GUID in the ID field to locate the one I needed to remove.

$spList.EventReceivers[0] | Select Id, Assembly, Type
$spList.EventReceivers[1] | Select Id, Assembly, Type
.
.
.

In my case, it was the second item in the list, so I ran this command to remove the event receiver:

$spList.EventReceivers[2].Delete()

That’s it!

DISCLAIMERS: I had to make an assumption since I didn’t have full command of how Event Receivers work nor how to manually create them. I assumed it was safe to delete the Event Receivers that were of the older SharePoint 2007 versions

Comments are closed.