0

I am using this method:

http://msdn.microsoft.com/en-US/library/microsoft.commerceserver.catalog.commonsearchoptions.setpaging.aspx

as such:

        CatalogSearch p = catalogContext.GetCatalogSearch();
        p.CatalogNames = "**";
        p.SearchOptions = new CatalogSearchOptions();
        p.SearchOptions.SetPaging(1, 400);
        p.SearchOptions.ClassTypes = CatalogClassTypes.ProductClass;

Typically, I would then do p.Search() and get a CatalogItemsDataSet. This is fine. What I can't figure out, is how do I go to the next page of results? My query will return around 7,500 results with a maximum of 500 per search call which isn't enough. Do I have to do this manually?

Stephen K
  • 697
  • 9
  • 26

1 Answers1

0

You have to loop or recurse your Search call, incrementing the pageNumber by your page size each time. Your page size is 400, so the paging code in the loop might look like this p.SearchOptions.SetPaging(lastPageNumber + 400); You stop when the Search method out totalRecords is less than the page size.

bentayloruk
  • 4,060
  • 29
  • 31