Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryParameters Ignored in GraphServiceClient Requests #2683

Open
ProteorCRE opened this issue Sep 26, 2024 · 6 comments
Open

QueryParameters Ignored in GraphServiceClient Requests #2683

ProteorCRE opened this issue Sep 26, 2024 · 6 comments
Labels

Comments

@ProteorCRE
Copy link

Describe the bug

The following code is used to retrieve group data from Microsoft Graph with specific QueryParameters:

var groupPage = await _graphServiceClient.Groups.GetAsync(requestConfiguration =>
{
    requestConfiguration.QueryParameters.Top = 999;
    requestConfiguration.QueryParameters.Select = new[] { "id", "displayName" };
    requestConfiguration.QueryParameters.Expand = new[] { "members" };
    requestConfiguration.QueryParameters.Filter = "securityEnabled eq true";
});

Issues Observed:

Top Parameter Ignored: Despite setting requestConfiguration.QueryParameters.Top = 999, only the default 100 results are returned. This indicates that the Top parameter is not being applied correctly, and the response is limited to the default page size.

Expand Parameter Not Applied: The Expand parameter is set to include the members property of each group. However, the response does not contain the expanded members data, suggesting that the Expand query option is being ignored or not processed as expected.

Expected behavior

The response should return up to 999 results per page.
Each group object should include its members as specified by the Expand parameter.

How to reproduce

            var groupPage = await _graphServiceClient.Groups.GetAsync(requestConfiguration =>
            {
                requestConfiguration.QueryParameters.Top = 999;
                requestConfiguration.QueryParameters.Select = ["id", "displayName"];
                requestConfiguration.QueryParameters.Expand = ["members"];
                requestConfiguration.QueryParameters.Filter = "securityEnabled eq true";
            })

SDK Version

5.58.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_
@ProteorCRE ProteorCRE added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Sep 26, 2024
@andrueastman
Copy link
Member

Thanks for raising this @ProteorCRE

Just to help us understand if this is an issue with the SDK or the API, any chance you've tried making a similar request on the Graph Explorer? http://aka.ms/ge

@andrueastman andrueastman added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Sep 30, 2024
@ProteorCRE
Copy link
Author

ProteorCRE commented Oct 1, 2024 via email

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Oct 1, 2024
@andrueastman
Copy link
Member

The sample code has the filter section. Do you get the expected response if you add it to the raw request?

requestConfiguration.QueryParameters.Filter = "securityEnabled eq true";

@andrueastman andrueastman added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed Needs: Attention 👋 labels Oct 2, 2024
@ProteorCRE
Copy link
Author

Yes

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Oct 3, 2024
@andrueastman
Copy link
Member

@ProteorCRE

From the snippet shared, I can confirm that the members are included in the response. Any chance its the same for you?

var groupPage = await graphClient.Groups.GetAsync(requestConfiguration =>
{
    requestConfiguration.QueryParameters.Top = 999;
    requestConfiguration.QueryParameters.Select = new[] { "id", "displayName" };
    requestConfiguration.QueryParameters.Expand = new[] { "members" };
    requestConfiguration.QueryParameters.Filter = "securityEnabled eq true";
});

foreach (var group in groupPage.Value)
{
    Console.WriteLine(group.Members.Count);
}

With regards to the Top parameter, the result comes back as 100 in both the SDK and Graph explorer. Any chance you can confirm the same from your end?

This suggests that's there;s possibly an upper limit for Top in some scenario (from my understanding, doing an expand on a large data set can be expensive for the API). We would probably need to follow up by asking this to the API owners at https://aka.ms/askGraph

@andrueastman andrueastman added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed Needs: Attention 👋 labels Oct 8, 2024
@ProteorCRE
Copy link
Author

I get the members now so I guess it won't be explained.
As for the top parameters, it still returns 100 results as well.
Not much impact on my side but still not as expected.
Thanks.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants