Thursday, July 26, 2012

How to Delete UserCustomAction for List in sharepoint 2010

In this post i will explain how to delete the custom action of user for list.By using action collection we can get all the user action events on the list.Then we will go through the all items in this collection up to get the desired location.Finally we can set the new location to action then update the list
SPUserCustomActionCollection cAct = orderlist.UserCustomActions;
foreach (SPUserCustomAction act in cAct)
{
//Microsoft.SharePoint.ListEdit ::By using this we can set the location property for list
if (act.Name.Equals("orders") && act.Location.Equals("Microsoft.SharePoint.ListEdit"))
{
act.Location = "test";
act.Update();
orderlist.Update();
break;
}
Post a Comment

Bel