Converting from API to SDK C# - unable to query microsoft.graph.group

Almog Rubinstein 6 Reputation points
2021-02-25T14:45:15.453+00:00

Hello Graph support,
I want to execute the following query:
GET https://graph.microsoft.com/beta/users/{id}/transitiveMemberOf/microsoft.graph.group?$orderby=displayName&$select=displayName

Via SDK but I am unable to address the microsoft.graph.group path,
What I was able to do is:
var userTransitiveMemberOfCollection =
await graphServiceClient.
Users[aadUserId].
TransitiveMemberOf.
Request().
GetAsync();

In the query above I'm unable to select the displayName because the return type is directoryObject and it has only the id property.
I also would like to query in the same way the user's directoryRole names, if possible, query all user's directory role and group names in 1 query.

Is there a way to execute the API request via your C# SDK?

I took this query from the example:
https://learn.microsoft.com/en-us/graph/api/user-list-transitivememberof?view=graph-rest-beta&tabs=http

Thanks,
Almog

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,645 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Freddie Christiansen 1 Reputation point
    2021-06-18T11:15:13.31+00:00

    Also facing the same issue. Still learning C# and the Microsoft Graph SDK, so any advice on this issue would be highly appreciated.

    107016-image.png

    107059-image.png

    0 comments No comments

  2. Sun, Nannan 1 Reputation point
    2022-10-17T09:58:42.067+00:00

    Any update here? I also have the same question....

    0 comments No comments