0

We have a list that is now over 5000 and the following stopped working. All the fields used in filters are indexed

var requestPendUri = webAbsUrl + "/_api/web/Lists/getByTitle('LeaveRequest')/Items?$\
        filter=(((Manager0 eq '" + str + "') and (Status eq 'Pending'))\
            or ((AltManager eq '" + str + "') and (Status eq 'Pending'))\
            or ((Manager0 eq '" + str + "') and (ChangeStatus eq 'Pending'))\
            or ((AltManager eq '" + str + "') and (ChangeStatus eq 'Pending')))&$\
        select=Id&$\
        top=500";   

    var ajaxPendCount = $.ajax({
        url: requestPendUri,
        async: false,  //pass value outside of ajax
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function (data) {
            myCount = data.d.results.length;
        },
        error: function (data) { alert("Failed to count items.");   }
    });

I've read through Manage large lists and libraries in SharePoint. Each view is filtered and columns are indexed but still not sure how to work around the issue with REST.

EDIT I typed https://tenant.sharepoint.com/_api/web/Lists/getByTitle('LeaveRequest')/Items?$filter=(((Manager0 eq '[email protected]') and (Status eq 'Pending')) or ((AltManager eq '[email protected]') and (Status eq 'Pending')) or ((Manager0 eq '[email protected]') and (ChangeStatus eq 'Pending')) or ((AltManager eq '[email protected]') and (ChangeStatus eq 'Pending')))

replacing all [email protected] with actual email address but IE just displayed `The website cannot display the page.

But, it seems to display data if I break it down to https://tenant.sharepoint.com/_api/web/Lists/getByTitle('LeaveRequest')/Items?$filter=((Manager0 eq '[email protected]') and (Status eq 'Pending')) or ((Manager0 eq '[email protected]') and (ChangeStatus eq 'Pending'))

and https://tenant.sharepoint.com/_api/web/Lists/getByTitle('LeaveRequest')/Items?$filter=((AltManager eq '[email protected]') and (Status eq 'Pending')) or ((AltManager eq '[email protected]') and (ChangeStatus eq 'Pending'))

13
  • Have ypu checked if the records returned by the filtered view are less than 5000? Sep 11, 2018 at 20:01
  • Yes, we only have 5016 records in list so far and there are only less than 100 pending items. Sep 11, 2018 at 20:49
  • Did you try hitting your url in the browser? If yes, what was the result? Sep 11, 2018 at 20:51
  • Should I be looking for anything specific? It says displaying 100/100 - doesn't really give me any hints if there's an error. Sep 11, 2018 at 20:56
  • Can you post a screenshot of the result in browser along with your url? Sep 11, 2018 at 20:57

1 Answer 1

0

Please use the search API to get the items based on your filters and then you can manipulate the items in the result source to what you want to do.

1
  • I've never used search API but will look into it. Thanks for the suggestion. Sep 11, 2018 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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