I can get the 5 first items of a list with caml :
var collListItemToBeUpdated = "";
var listItemToBeUpdated = "";
var enumerator;
function getItemsToBeUpdated2() //this function called on button click to get ID's
{
var clientContext = new SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle('Matériel Recyclage');
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml("<View> <Query> <OrderBy> <FieldRef Name='ID' Ascending='True' /> </OrderBy> </Query> <RowLimit>10</RowLimit></View> ");
collListItemToBeUpdated = oList.getItems(camlQuery);
clientContext.load(collListItemToBeUpdated);
clientContext.executeQueryAsync(getItemsToBeUpdatedSuccess2, getItemsToBeUpdatedFailed2);
}
function getItemsToBeUpdatedSuccess2()
{
var i = 0;
enumerator = collListItemToBeUpdated.getEnumerator();
while (enumerator.moveNext()) {
if(i>4)
{
var oItem = enumerator.get_current();
var oListItem = oList.getItemById(oItem.get_id());
oListItem.set_item('Palette', '2');
oListItem.update();
itemArray.push(oListItem);
clientContext.load(itemArray[itemArray.length-1]);
}
i++;
clientContext.executeQueryAsync(updateMultipleListItemsSuccess2, updateMultipleListItemsFailed2);
}
//updateMultipleListItems2();
}
function getItemsToBeUpdatedFailed2(sender, args)
{
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
function updateMultipleListItems2() //this function called on successfully getting ID's
{
var itemArray = [];
var clientContext = SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle('Matériel Recyclage');
while(enumerator.moveNext())
{
var oItem = ListItemToBeUpdated.get_current();
var oListItem = oList.getItemById(oItem.get_id());
oListItem.set_item('Palette', '2');
oListItem.update();
itemArray.push(oListItem);
clientContext.load(itemArray[itemArray.length-1]);
}
clientContext.executeQueryAsync(updateMultipleListItemsSuccess2, updateMultipleListItemsFailed2);
}
function updateMultipleListItemsSuccess2()
{
alert('Items Updated');
}
function updateMultipleListItemsFailed2(sender, args)
{
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
But can you tell me how to get the five items after? I mean not 1, 2, 3, 4, 5 but 6, 7, 8, 9, 10. Something like RowBegin=5
I'm not looking for something based on ID, but based on the number of rows, something that can be used with my code.
Thanks