0

I noticed that SharePoint is returning empty results if a folder contains more than 5000 files. I am using the following URL. /_api/Web/GetFolderByServerRelativeUrl('folderRelativeUrl')/Files. Is there a way to retrieve all the possible documents with the same URL?

1

There is no way SharePoint rest API can return more than 5k result in a single call. you have to use batch request or apply pagination or do loop but it will have multiple rest call. you can have look below code for reference

var url = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('DocumentList')/items?$select=customerID&$top=1000";
    var response = response || [];  // this variable is used for storing list items
    function GetListItems(){
        return $.ajax({
            url: url,  
            method: "GET",  
            headers: {  
                "Accept": "application/json; odata=verbose"  
            },
            success: function(data){
                response = response.concat(data.d.results);
                if (data.d.__next) {
                    url = data.d.__next;
                    GetListItems();
                }
                $.each(response, function(index, item) {
                    arrayCustomerID[index] = item.customerID;
                });
            },
            error: function(error){
            }
        });
    }

ref :Rest to read more than 5000 items from document library

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.