microsoftgraph / microsoftgraph/msgraph-sdk-dotnet

DirectoryObjects.GetByIds and select in v5

Open
#1,975 2 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug: metadata OpenApi
Dominant language
C#
Stars
789
Forks
264
Avg merge
15h 17m
Merged PRs (30d)
3

Description

Is your feature request related to a problem? Please describe.
The Graph API has a know issue with getByIds https://learn.microsoft.com/en-us/graph/known-issues#incomplete-objects-are-returned-when-using-getbyids-request
With the graph sdk v4 it was possible to use this:

                var dictionaryObjects = await graphServiceClient.DirectoryObjects
                    .GetByIds(chunk)
                    .Request()
                    .Select("id,type,displayName,mailNickname")
                    .PostAsync();

Describe the solution you'd like
A way to use the select parameter with the getByIds Post method in v5

Describe alternatives you've considered
Stay on v4

or

use the ToPostRequestInformation and overwrite the URI

                var ri = graphServiceClient.DirectoryObjects.GetByIds.ToPostRequestInformation(
                    new Microsoft.Graph.DirectoryObjects.GetByIds.GetByIdsPostRequestBody()
                    {
                        Ids = chunk.ToList(),
                    }
                );
                ri.URI = new Uri(ri.URI + "?$select=id,type,displayName,mailNickname");
                var dictionaryObjects =
                    await graphServiceClient.RequestAdapter.SendAsync<GetByIdsResponse>(
                        ri,
                        GetByIdsResponse.CreateFromDiscriminatorValue
                    );

Additional context
Add any other context or screenshots about the feature request here.

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 with the DirectoryObjects.GetByIds POST request and the ToPostRequestInformation and SendAsync usage shown in the issue. Determine how v5 request options represent the $select parameter, then verify that GetByIds can send the requested fields without URI overwriting; the issue provides no test file or implementation path.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.