How to access SharePoint online list data which has 60000 items in it using JSOM . Indexing is not done on any of the list columns .Whenever trying to access SharePoint list data , it is giving "Error : it exceeds the list view threshold enforced by the administrator".


Below is the JSOM code to fetch all the items from the list more than 5000 iteams. I have used "get_listItemCollectionPosition" for this purpose:

<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<script type="text/javascript">


    var items;
    var query;
    var ctx;
    var list;
    function getAllItems() {
        ctx = SP.ClientContext.get_current();
        list = ctx.get_web().get_lists().getByTitle('TestList');
        query = new SP.CamlQuery();
        var camalQueryString = "<View><ViewFields><FieldRef Name = 'Id'/></ViewFields><RowLimit>150</RowLimit></View>";
        items = list.getItems(query);
            Function.createDelegate(this, this.onQuerySucceeded),
            Function.createDelegate(this, this.onQueryFailed)
    function onQuerySucceeded(sender, args) {
        var enumerator = items.getEnumerator(),
            simpleArray = [];
        while (enumerator.moveNext()) {


        var position = items.get_listItemCollectionPosition();
        if (position != null) {
        } else {
            alert("All items retrieve successfully!!");
    function onQueryFailed(sender, args) {
        alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());

Reference Post are :

http://www.sharepointpals.com/post/The-attempted-operation-is-prohibited-because-it-exceeds-the-list-view-threshold-enforced-by-the-administrator-SharePoint-Office-365 (Shared by Max576_SPWX)

Let me know if it helps you.


You need to perform a filter within a View on an indexed column. If you don’t create an indexed column, the query will go through 60000 rows in content database, which causes the error.

A workaround: http://www.sharepointpals.com/post/The-attempted-operation-is-prohibited-because-it-exceeds-the-list-view-threshold-enforced-by-the-administrator-SharePoint-Office-365


If list has more than 5000 items

  1. Indexing the Columns that CAML query apply filters
  2. Specifying a row limit

Even though the Columns are indexed if the the list have more than 5000 items that match a filter on a column in the query it still throws the exception.


Here listItemCollectionPostion property is being used to execute the query in batch, so that throttling limit does not effect the query execution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.