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 'first.last@tenant.com') and (Status eq 'Pending')) or ((AltManager eq 'first.last@tenant.com') and (Status eq 'Pending')) or ((Manager0 eq 'first.last@tenant.com') and (ChangeStatus eq 'Pending')) or ((AltManager eq 'first.last@tenant.com') and (ChangeStatus eq 'Pending')))

replacing all first.last@tenant.com 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 'first.last@tenant.com') and (Status eq 'Pending')) or ((Manager0 eq 'first.last@tenant.com') and (ChangeStatus eq 'Pending'))

and https://tenant.sharepoint.com/_api/web/Lists/getByTitle('LeaveRequest')/Items?$filter=((AltManager eq 'first.last@tenant.com') and (Status eq 'Pending')) or ((AltManager eq 'first.last@tenant.com') and (ChangeStatus eq 'Pending'))

  • Have ypu checked if the records returned by the filtered view are less than 5000? – harshal gite Sep 11 '18 at 20:01
  • Yes, we only have 5016 records in list so far and there are only less than 100 pending items. – Tamras Merin Sep 11 '18 at 20:49
  • Did you try hitting your url in the browser? If yes, what was the result? – harshal gite Sep 11 '18 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. – Tamras Merin Sep 11 '18 at 20:56
  • Can you post a screenshot of the result in browser along with your url? – harshal gite Sep 11 '18 at 20:57
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.

  • I've never used search API but will look into it. Thanks for the suggestion. – Tamras Merin Sep 11 '18 at 20:57

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.