msgraph-sdk-dotnet icon indicating copy to clipboard operation
msgraph-sdk-dotnet copied to clipboard

DirectoryObjects.GetByIds and select in v5

Open StefanSchoof opened this issue 2 years ago • 1 comments

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.

StefanSchoof avatar Jun 20 '23 10:06 StefanSchoof