Monday, May 2, 2022

Retrieve more than 5000 items from SharePoint List

I actually have struggled with masses even as my list is getting large and want to retrieve the rows more than 5K. Here I located the answer is to apply the Recursive call to retrieve more than 5K items.


Here we're doing the recursive call to the GetListItems() function. This will fetch information withinside the bunch of a thousand objects and concatenate it to the response variable.

Here data.d.__next includes the URL to get the next set of items. In case we don’t have more items left to fetch, it'll not call GetListItems() function.


Hope many of us will find this helpful.

2 comments:

  1. How to get & edit list items from the list having 25k items?

    ReplyDelete
    Replies
    1. Use following code to retrieve data using RESTAPI.

      function getRecord(id){
      let urlString = `https://mysite.sharepoint.com/_api/Web/Lists/GetByTitle('my25KList')/items?$select=Id,Title&$filter=ID eq '${id}'`;
      let call = returnAjax(urlString);
      call.done(function (data,textStatus, jqXHR){
      // do some action
      }); // call.done

      call.fail(function (jqXHR,textStatus,errorThrown){
      alert("Error retrieving Tasks: " + jqXHR.responseText);
      });
      }//getRecord

      Delete

Your feedback is always appreciated. I will try to reply to your queries as soon as time allows.Please don't spam,spam comments will be deleted upon reviews.