There are times when you want to check which event receivers are attached to a SharePoint list. This can be easily achieved through use of a PowerShell script.
There are also times when you might want to remove any event receivers from the list
$spWeb = Get-SPWeb Identity http://sharepoint
$spList = $spWeb.Lists["My List"]
$spList.EventReceivers | Select Name, Assembly, Type
$spList = $spWeb.Lists["My List"]
$spList.EventReceivers | Select Name, Assembly, Type
$spWeb = Get-SPWeb Identity http://sharepoint
$spList = $spWeb.Lists["My List"]
$spList.EventReceivers | Select Name, Assembly, Type
$eventsCount = $spList.EventReceivers.Count
for ($i = $eventsCount-1; $i -ge 0; $i--)
{
$spList.EventReceivers[$i].Delete()
}
$spList.Update()
$spList = $spWeb.Lists["My List"]
$spList.EventReceivers | Select Name, Assembly, Type
$eventsCount = $spList.EventReceivers.Count
for ($i = $eventsCount-1; $i -ge 0; $i--)
{
$spList.EventReceivers[$i].Delete()
}
$spList.Update()
No comments:
Post a Comment