Forum Discussion
Lokids
Jun 11, 2024Copper Contributor
Only get part of the sharepoint list with JavaScript Fetch
Hello.
I have a problem with getting all SP list item (257 currently) with fetch.
I have the following code:
var tasks = new Request(
webUrl + "/_api/web/lists/GetByTitle('" + listName + "')/items?$top=300"
, {
method: "GET",
credentials: 'same-origin',
headers: new Headers({
"Accept": "application/json; odata=nometadata",
})
});
fetch(tasks)
.then((response) => response.json())
.then((data) => {
let items = data.value;
console.log('Van: ' + data["@odata.nextLink"])
items.forEach((item) => {
console.log(item.ID,item.Title,item.Program);
});
});
Without the top=300 part it only list 131 item (with it i get all item).
And the odata.nextLink is undefined. So it seems i dont get that.
How can i get all data?
No RepliesBe the first to reply