microsoftgraph / microsoftgraph/msgraph-sdk-dotnet

Support combining nested LINQ Expand and Select

Open
#2,439 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:feature
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 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)

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 nested Expand and Select expression in the issue and compare the generated request with the Graph Explorer URL shown. Done means the SDK accepts the expression and produces the nested $expand memberOf($select=id,displayName) query alongside the top-level selection.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.