How to create custom action for list items using Client Object Model
Requirement – …You need to add custom action to list items using client object model. This user custom action menu item will be added to drop-down menu which is displayed for list items.
using Microsoft.SharePoint.Client; string urlWebsite = “http://xxxxxxxx:9999/”; ClientContext clientContext = new ClientContext(urlWebsite); Web oWebsite = clientContext.Web; List oList = oWebsite.Lists.GetByTitle(“TestList”); UserCustomActionCollection collUserCustomAction = oList.UserCustomActions; UserCustomAction oUserCustomAction = collUserCustomAction.Add(); oUserCustomAction.Location = “EditControlBlock”; oUserCustomAction.Sequence = 100; oUserCustomAction.Title = “How to in SharePoint”; oUserCustomAction.Url = @”http://howtoinsharepoint.blogspot.in/”; oUserCustomAction.Update(); clientContext.Load(oList, list => list.UserCustomActions); clientContext.ExecuteQuery();
Location property specifies EditControlBlock,
Sequence specifies an order of placement in relation to other user custom actions,
Url specifies an absolute path to a page that defines the action.
Hope this helps…Happy Coding!!!!
(Visited 93 times, 1 visits today)