This is how you can delete Event handlers from a SPList
$webUrl= "http://yoursite.com/subsite"
$listName = "myList"
$site = Get-SPSite($siteUrl)
$web = $site.OpenWeb()
$listWithEventHandlers = $web.Lists[$listName]
#you can find out the index of the eventhadler through a selector, or just beeing lazy
#and loop the eventhanlders
$allEvenReceivers = $list.EventReceivers
foreach($ev in $allEvenReceivers )
{
write-host $ev.Name;
}
$index = 0
$eventHandlerToDelete = $listWithEventHandlers.EventReceivers[$index]$eventHandlerToDelete.Delete()
$listWithEventHandlers.Update()
$web.Dispose()
$site.Dispose()
No comments:
Post a Comment