Skip to content

Instantly share code, notes, and snippets.

@maisarissi
Last active February 8, 2023 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maisarissi/b7f2a5bde58923bad0439a6c770db149 to your computer and use it in GitHub Desktop.
Save maisarissi/b7f2a5bde58923bad0439a6c770db149 to your computer and use it in GitHub Desktop.
msgraph-dotnet-v5-rc-pagination
var usersResponse = await graphServiceClient
    .Users
    .GetAsync(requestConfiguration => {
        requestConfiguration.QueryParameters.Select = new string[] {"id", "createdDateTime"};
        requestConfiguration.QueryParameters.Top = 1; });
var userList = new List<User>();
var pageIterator = PageIterator<User,UserCollectionResponse>
    .CreatePageIterator(graphServiceClient,usersResponse, (user) => {
userList.Add(user);
return true; });
await pageIterator.IterateAsync();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment