Duplicated Data-Item Elemets in Paging

APIPointNewbie 146 Reputation points
2021-09-14T20:13:40.35+00:00

Hello,

I have the following problem the pages are limited with data items and I have thought of the following solution

var driveItems = new List<DriveItem>();
driveItems.AddRange(search.CurrentPage);
            while (search.NextPageRequest != null)
            {
                search = await search.NextPageRequest.GetAsync();
                driveItems.AddRange(search.CurrentPage);
            }
            return driveItems;
        }

I wanted to test this by setting only 10 entries per page:

 search = await graphClient.Drives[searchInfos.DriveId]
                                             .Items[searchInfos.ItemId]
                                             .Search(searchInfos.SearchName)
                                             .Request(queryOptions).Top(10)
                                             .GetAsync();

but then I get some duplicates.

What have I done wrong ?

Microsoft Graph Applications API
Microsoft Graph Applications API
A Microsoft API that enables you to manage these resources and actions related to applications in Azure Active Directory.
566 questions
Microsoft Graph Files API
Microsoft Graph Files API
A Microsoft API to create an app that connects with files across OneDrive, OneDrive for Business, and SharePoint document libraries.
354 questions
Microsoft Graph Search API
Microsoft Graph Search API
A Microsoft API that searches for information in email messages, returns messages ranked by relevance, and renders a dedicated search experience.
177 questions
Microsoft Graph SDK
Microsoft Graph SDK
A Microsoft software developer kit designed to simplify building high-quality, efficient, and resilient applications that access Microsoft Graph.
891 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
8,238 questions
{count} votes

1 answer

Sort by: Most helpful
  1. APIPointNewbie 146 Reputation points
    2021-09-16T08:12:02.8+00:00

    Hello, when I run my code and pass a top = 10 (.Top(10)) as a parameter, some files repeat in my result list (C#).