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

Support combining nested LINQ Expand and Select

Open duckblaster opened this issue 3 months ago • 2 comments

Is your feature request related to a problem? Please describe the problem.

I am trying to select only a couple of properties from an expanded collection using LINQ, but .Expand() doesn't allow using .Select() on sub properties.

Describe the solution you'd like.

graphServiceClient
  .Me
  .Request()
  .Select(x => new { x.Id, x.Mail, x.DisplayName, x.Department })
  .Expand(x => new { MemberOf = x.MemberOf.Select(x => new { x.Id, x.DisplayName }) })

Additional context?

The query that I an trying to generate, that I have verified works in graph explorer: https://graph.microsoft.com/v1.0/me?$select=id,mail,department,displayName&$expand=memberOf($select=id,displayName)

duckblaster avatar Apr 16 '24 00:04 duckblaster