Get 50000 items from SharePoint List using JS-SharePoint Item 5000 Threshold Issue [Solved] –


My blog will help to load data from SharePoint list regardless of list-view threshold limit . I have been through many forums and even I experienced bit difficulty to load data from list having record greater than limit defined by the SharePoint administrator (threshold limit). I have created a simple JS file with some functions to load data in chunks. i.e. My JS function will automatically take the total count of list and break them in the chunks and iterate them. In the result it will provide the array of items requested by the user.

Global Varaiable
Screen shot is to provide the global variable for our JS File
Initial Method to Call from my js
Initial Method to Call from my js
Internal method of JS File, This methods will take the cound of the List and divide them as 5000 each cycle
Internal method of JS File, This methods will take the cound of the List and divide them as 5000 each cycle

 

 

 

Final Methods will runs once all the data finish loading

Final Methods will runs once all the data finish loading

Just add the attached JS file to your SharePoint Solution and call the below mentioned function. In return once the data get loaded , it will write the desired array to flatArray and update var TransactionComplete = 1; further you can use flatArray with data in your app.
JS File – Click here to Download – Rename PDF to JS

Funciton to call GetListItem(siteurl,listname,columns)

siteurl = http://sitename

listname=testlist

columns=ID,Created,Title,Column1,Column2,Column4,Column5

Result = flatArray as Array

Resultant Screen shot.

ResultArray
ResultArray

 

I hope my little efforts may save time for those who are struggling with SharePoint threshold 5000 issue.

Advertisements