microsoftgraph / microsoftgraph/msgraph-sdk-dotnet

Skip parameter for User / Group search

Open
#2,914 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Blocked Bug: metadata dependency:metadata status:waiting-for-dependency type:bug
Dominant language
C#
Stars
789
Forks
264
Avg merge
15h 17m
Merged PRs (30d)
3

Description

Describe the bug

I'm trying to extract users in pages and I found something peculiar:
The UsersRequestBuilderGetQueryParameters class has the Top parameter. But no Skip parameter. So, when I search with a filter, and my frontend requested the first 20 entries, I'd fill out Top = 20. And get what I want. If the frontend user decides, 'I need to see the next 20', I'd have to request Top = 40, and discard the first 20.

Whereas, if I do the same for Groups, the GroupsRequestBuilderGetQueryParameters has both Top and Skip parameters, allowing me to request entries only 20-40.

But, maybe it's the Groups API that is wrong. The documentation states that the $skip parameter isn't supported

Either way.. if the documentation is wrong and $skip is allowed, it ought to be in both QueryParameter classes, if the documentation is wrong and $skip is not supported for either User and Group, then it should be removed from GroupsRequestBuilderGetQueryParameters

Expected behavior

I'd like to be able to use Skip for user searches as well.

How to reproduce

Search users on your GraphServiceClient as follows (GraphServiceClient instantiation omitted for brevity)

var items = await graphServiceClient.Users.GetAsync(requestConfiguration =>
{
    if (attributeList?.Count > 0) requestConfiguration.QueryParameters.Select = attributeList?.ToArray();
    if (!string.IsNullOrEmpty(filter)) requestConfiguration.QueryParameters.Filter = filter;
    if (pageSize > 0) requestConfiguration.QueryParameters.Top = pageSize;
//    requestConfiguration.QueryParameters.Skip = / parameter not found
    if (includeCount)
    {
        requestConfiguration.QueryParameters.Count = true;
        requestConfiguration.Headers.Add("ConsistencyLevel", "eventual");
    }
}).ConfigureAwait(false);
SDK Version

5.79.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output
Configuration
  • OS: Win 11 Professional, x64
Other information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing UsersRequestBuilderGetQueryParameters with GroupsRequestBuilderGetQueryParameters and check the linked Microsoft Graph group-list documentation for supported $skip behavior. Confirm the intended behavior for user and group searches, then update the relevant query-parameter definitions and verification coverage so pagination is consistent with the API contract.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.