microsoftgraph / microsoftgraph/msgraph-sdk-dotnet
client.Users.GetByIds.PostAsGetByIdsPostResponseAsync Does not allow for $select parameter
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 789
- Forks
- 264
- Avg merge
- 15h 17m
- Merged PRs (30d)
- 3
Description
Describe the bug
I would like to select a group of users with their known identities by doing the following request:
POST /v1.0/users/getByIds?$select=id,displayName,identities HTTP/1.1
Host: graph.microsoft.com
Content-Type: application/json
Content-Length: 48
{"ids":["aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"]}
This should be translate to something like the following in C#
var user = await client.Users
.GetByIds.PostAsGetByIdsPostResponseAsync(new GetByIdsPostRequestBody()
{
Ids = ["aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"],
}, cfg =>
{
cfg.QueryParameters.Select = ["id", "displayName", "identities"];
});
However the cfg.QueryParameters.Select property is not available for client.Users.GetByIds.PostAsGetByIdsPostResponseAsync() request
Expected behavior
The Select query parameter should be available in the PostAsGetByIdsPostResponseAsync configuration body, as it is available in the actual api
How to reproduce
Use the following code snippet:
var user = await client.Users
.GetByIds.PostAsGetByIdsPostResponseAsync(new GetByIdsPostRequestBody()
{
Ids = ["aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"],
}, cfg =>
{
cfg.QueryParameters.Select = ["id", "displayName", "identities"];
});
SDK Version
5.68.1
Latest version known to work for scenario above?
No response
Known Workarounds
non,
something like the following should work, but the query parameters are ignored:
var postRequest = client.Users.GetByIds.ToPostRequestInformation(new()
{
Ids = ["aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"]
});
postRequest.QueryParameters.Add("%24select", "id,displayName,identities");
var users = await client.RequestAdapter.SendAsync<GetByIdsPostResponse>(postRequest, GetByIdsPostResponse.CreateFromDiscriminatorValue);
Debug output
No response
Configuration
- Dotnet version: 8.0
Other information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at client.Users.GetByIds.PostAsGetByIdsPostResponseAsync and its ToPostRequestInformation entry point, then inspect the request configuration and query-parameter definitions. The change is done when cfg.QueryParameters.Select is available for this request and is included in the outgoing request; compare the RequestAdapter.SendAsync workaround to verify the parameter is honored.
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
- 42/100