Scenario:
You want to deleting all the registered event handler from a particular list/library
Code:
using Microsoft.SharePoint ;Use:
SPSite site = new SPSite("http://mossserver");
SPWeb web = site.AllWebs["/"];
SPList list = web.Lists["List_Name"];
int itemCount = list.EventReceivers.Count;
for (int k = itemCount-1 ; k >= 0 ; k--)
{
list.EventReceivers[k].Delete();
}
Console Application, At the time of Feature De-activation
0 comments:
Post a Comment