Auto Paginating Search Results in Box Windows SDK V2

New post


1 comment

  • mwiller

     There is not currently a way to pull all search results; the recommended approach is to ask for as many as you need and then page through the results until you find what you're looking for.  Here's an example of one approach you might take:



    var pageSize = 30; // number of results per page, maximum 200
    var offset = 0;
    var query = "Your Search Query";
    var limit = 500; // total number of search results to retrieve while (pageSize + offset <= limit) // search through the first 500 total results { var results = await client.SearchManager.SearchAsync(query, offset: offset, limit: pageSize); if (/* you found what you wanted in the results */) { break; } offset += pageSize; }



    Comment actions Permalink

Please sign in to leave a comment.