Add user custom action to Site Actions menu 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)
{

//Add user custom action to Site Actions menu using Client Object Model

string siteURL = "http://serverName:1111/sites/SPSiteDataQuery/";
ClientContext context = new ClientContext(siteURL);

UserCustomActionCollection collUserCustomAction =context.Web.UserCustomActions;
UserCustomAction userCustomAction = collUserCustomAction.Add();
userCustomAction.Location =
"Microsoft.SharePoint.StandardMenu";
userCustomAction.Sequence = 100;
userCustomAction.Group =
"SiteActions";
userCustomAction.Title =
"Custom Site Action";
userCustomAction.Url =
"/_layouts/settings.aspx";
userCustomAction.Update();
context.Load(userCustomAction);
context.ExecuteQuery();
}
}
}