Delete the user custom action from ECB using Client Object Model
In this blog we will be seeing how to delete the user custom action from ECB using Client Object Model
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Client;
namespace ClientObjectModel
{
class Program
{
static void Main(string[] args)
{
//Delete the user custom action from ECB using Client Object Model
string siteURL = "http://serverName:1111/sites/SPSiteDataQuery/";
ClientContext context = new ClientContext(siteURL);
List list = context.Web.Lists.GetByTitle("Shared documents");
UserCustomActionCollection collUserCustomAction = list.UserCustomActions;
context.Load(collUserCustomAction);
context.ExecuteQuery();
foreach (UserCustomAction userCustomAction in collUserCustomAction)
{
if (userCustomAction.Title.ToString() == "Custom Action")
{
userCustomAction.DeleteObject();
context.Load(userCustomAction);
context.ExecuteQuery();
}
}
}
}
}


Simon YangPosted Apr 22, 2013, 9:24 PM EDT
Hi Vijai, Actually, ClientOM.UserCustomActionCollection collUserCustomAction = list.UserCustomActions can not get the ECB menu. What's wrong with me?