Click here to Skip to main content
15,921,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

How to start a SharePoint Client Object Model project in Visual studio - SharePoint 2010

I want to do a SharePoint task of updating a list, can somebody help me what are the basic steps to be
done in visual studio 2010 to execute this code

Which VSS project project template I should select ( console application, Empty project, windows application etc ????? )

File -> New -> Project ???????? which template I should select??????

static void Main(string[] args)
{
using (ClientContext clientContext = new ClientContext("http://mylocalhost/"))
{

Site siteCollection = clientContext.Site;
Web site = clientContext.Web;
List registration = site.Lists.GetByTitle("listsample");
ListItemCollection lItems = registration.GetItems(new CamlQuery());
clientContext.Load(lItems, items => items.Include(i => i["Itm1"], i => i["Itm2"], i => i["Itm3"]));
clientContext.ExecuteQuery();
foreach (ListItem item in lItems)
{
item["Itm2"] = "Success";
item.Update();
clientContext.ExecuteQuery();
}

}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900