This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} | |
} |