using System;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Client;
namespace ECBUserCustomAction
{
class Program
{
static void Main(string[] args)
{
string siteURL = "http://serverName:1111/sites/SPSiteDataQuery/";
ClientContext context = new ClientContext(siteURL);
List list = context.Web.Lists.GetByTitle("Shared documents");
UserCustomActionCollection collUserCustomAction = list.UserCustomActions;
UserCustomAction userCustomAction = collUserCustomAction.Add();
userCustomAction.Location = "EditControlBlock";
userCustomAction.Sequence = 100;
userCustomAction.Title = "My Custom Action";
userCustomAction.Url = "/_layouts/settings.aspx";
userCustomAction.Update();
context.Load(list,
oList => oList.UserCustomActions);
context.ExecuteQuery();
}
}
}