Skip to content

client.Users.GetByIds.PostAsGetByIdsPostResponseAsync Does not allow for $select parameter #2796

@mligtenberg

Description

@mligtenberg

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependency:metadataAwaiting fix from core dependency project moduletype:bugA broken experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions