I have a WPF application I've built that relies on data within a SharePoint list (synced from a website). I believe, perhaps incorrectly that this query will be limited to retrieving 100 rows at a time.
Is there a way to batch my requests so I can fetch more than 100 rows in the one query?
private static ListItemCollection LoadListItemCollection(string status)
{
using (var ctx = new ClientContext("http://sharepoint/resources"))
{
var list = ctx.Web.Lists.GetByTitle("Resource Orders");
var query = new CamlQuery
{
ViewXml = @"<View><Query><Where><Eq><FieldRef Name=""Status""></FieldRef><Value Type=""Text"">Approved</Value></Eq></Where></Query></View>"
};
switch (status)
{
case "Ordered":
query.ViewXml =
@"<View><Query><Where><Eq><FieldRef Name=""Status""></FieldRef><Value Type=""Text"">Ordered</Value></Eq></Where></Query></View>";
break;
case "History":
query.ViewXml =
@"<View><Query><Where><In><FieldRef Name=""Status""/><Values><Value Type=""Text"" >Rejected</Value><Value Type=""Text"">Dispatched</Value><Value Type=""Text"">Ordered</Value><Value Type=""Text"">Approved</Value></Values></In></Where></Query></View>";
break;
case "Approved":
default:
query.ViewXml =
@"<View><Query><Where><Eq><FieldRef Name=""Status""></FieldRef><Value Type=""Text"">Approved</Value></Eq></Where></Query></View>";
break;
}
var collListItem = list.GetItems(query);
ctx.Load(
collListItem,
items =>
items.Include(
item => item.Id,
item => item.DisplayName,
item => item.HasUniqueRoleAssignments,
item => item["Status"] ,
item => item["Persona"],
item => item["Quantity_x0020_Ordered"],
item => item["Resource_x0020_Name"],
item => item["Title"],
item => item["Customer_x0020_E_x002d_mail"],
item => item["Customer_x0020_Phone_x0020_Numbe"],
item => item["Customer_x0020_Street"],
item => item["Customer_x0020_Suburb"],
item => item["Customer_x0020_Postcode"],
item => item["Organization"],
item => item["Modified"],
item => item["Created"]));
ctx.ExecuteQuery();
return collListItem;
}
}
Also interested in whether there's a better way to tackle the problem than I have above.