Tuesday, January 5, 2016

How to access the sharepoint 2013 list from another web application using CSOM

we have to add this reference

Microsoft.SharePoint.Client
Microsoft.SharePoint.Client.Runtime

ClientContext context = new ClientContext("http://peakfinders");

Web web = context.Web;

List list = web.Lists.GetByTitle(“Users”);

CamlQuery caml=new CamlQuery();

ListItemCollection items = list.GetItems(caml);

context.Load<List>(list
context.Load<ListItemCollection>(items
context.ExecuteQuery();

foreach (Microsoft.SharePoint.Client.ListItem item in items)

{

Console.WriteLine(item.FieldValues["Title"]);

}

Console.ReadLine();

No comments:

Post a Comment