SharePoint SPFX renderListDataAsStream + Paging from large list, incorrect results

Viewed 18

We have a large list, around 13k items. To query we use below code (page size is 100), and view is my pending tasks -

   try {
         return await sp.web.lists.getByTitle(spListName).views.getByTitle(viewTitle).get()
            .then(async v => {
                const xml = "<View Scope='RecursiveAll'><RowLimit Paged='TRUE'>" + this._pageSize + "</RowLimit><Query>" + v.ViewQuery + "</Query></View>";

                return await sp.web.lists.getByTitle(spListName).renderListDataAsStream({
                    ViewXml: xml,
                    Paging: paging,
                }).then((res) => {
                    return res;
                });
            });
            
    } catch (error) {
        console.log(error);
    }

But it returns the results incorrectly. First we get few results (say 5), then when we query with the NextHref we get next set (say 40), then when we query with the NextHref we get next set (say 4). It should ideally return all 49 at one go as the page size is 100.

0 Answers
Related