Sharepoint 2013 Get Items from a list CSOM :
Soltion :
using (ClientContext ctx = new ClientContext("https://xyz/sites/abc"))
{
Web web = ctx.Web;
List list = web.Lists.GetById(new Guid("12345-56655-2sdfgsrg-345235-23ddcs444"));
var q = new CamlQuery() { ViewXml = "<View><Query><Where><IsNotNull><FieldRef Name='ID' /></IsNotNull></Where></Query></View>"};
var r = list.GetItems(q);
ctx.Load(r);
ctx.ExecuteQuery();
}
in the above example we are retiving list values where id is not null .
After retriving the list values you can assign this var type result to ineumerable to perform linq or any other data formating,filtering operations
EX: IEnumerable<ListItem> lc = r.ToList();
Soltion :
using (ClientContext ctx = new ClientContext("https://xyz/sites/abc"))
{
Web web = ctx.Web;
List list = web.Lists.GetById(new Guid("12345-56655-2sdfgsrg-345235-23ddcs444"));
var q = new CamlQuery() { ViewXml = "<View><Query><Where><IsNotNull><FieldRef Name='ID' /></IsNotNull></Where></Query></View>"};
var r = list.GetItems(q);
ctx.Load(r);
ctx.ExecuteQuery();
}
in the above example we are retiving list values where id is not null .
After retriving the list values you can assign this var type result to ineumerable to perform linq or any other data formating,filtering operations
EX: IEnumerable<ListItem> lc = r.ToList();
Comments
Post a Comment