Sharepoint - List API get all items limited to 100 rows
The limit is due to server-driven paging. It protects against developers inadvertently making a request that returns large result sets.
You can use $top if you really want a large result set to be returned. Otherwise you can get the results a page at a time by checking __next. If it has a value, it contains the url that will return the next set of items. If it's null, you've hit the end of the result set.
function callToHostWeb() {
var message = jQuery("#message");
message.text("");
var hostUrl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
var appUrl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));
var scriptbase = hostUrl + "/_layouts/15/";
var url = appUrl + "/_api/SP.AppContextSite(@target)/Web/Lists/getByTitle('Order Details')/Items?$select=Title&@target='" + hostUrl + "'";
jQuery.getScript(scriptbase + "SP.RequestExecutor.js", getOrderDetails);
function getOrderDetails() {
var executor = new SP.RequestExecutor(appUrl);
executor.executeAsync(
{
url: url,
method: "GET",
dataType: "json",
headers: {
Accept: "application/json;odata=verbose"
},
success: function (data) {
var response = JSON.parse(data.body);
message.append(String.format("Retrieved {0} items", response.d.results.length));
message.append("<br/>");
if (response.d.__next) {
url = response.d.__next;
getOrderDetails();
}
},
error: function (data, errorCode, errorMessage) {
alert(errorMessage);
}
}
);
}
function getQueryStringParameter(paramToRetrieve) {
var params =
document.URL.split("?")[1].split("&");
var strParams = "";
for (var i = 0; i < params.length; i = i + 1) {
var singleParam = params[i].split("=");
if (singleParam[0] == paramToRetrieve)
return singleParam[1];
}
}
}
/_api/web/lists/GetByTitle('ListName')/items?$top=1000
the "$limit=" option above does NOT work. however, the $top= does.