microsoftgraph / msgraph-sdk-dotnet

Microsoft Graph Client Library for .NET!
https://graph.microsoft.com
Other
699 stars 248 forks source link

Error when searching a specific user in Groups/Members #2093

Open bobs619 opened 1 year ago

bobs619 commented 1 year ago

This is erroring out in V5. var members = await _graphServiceClient.Groups[groupId].Members[id].GraphUser.GetAsync()

In V4 I could do this NO PROBLEM: var members = await _graphServiceClient.Groups[groupId].Members[id].Request().GetAsync()

Right now, i have do something funky to get this to work.

  {
      requestConfiguration.QueryParameters.Count = true;
      requestConfiguration.QueryParameters.Filter = $"id eq '{id}'";
      requestConfiguration.Headers.Add("ConsistencyLevel", "eventual");
  });

Am I doing something wrong? Please advise.

andrueastman commented 1 year ago

Thanks for raising this @bobs619

Any chance you can share more details the error you get when you call

var members = await _graphServiceClient.Groups[groupId].Members[id].GraphUser.GetAsync()
bobs619 commented 1 year ago

@andrueastman

Here's some details... IDE: VS2022 17.8.0 Preview 1.0 Project: Function APP V4 Isolated .NET 7SDK Microsoft.Graph (5.24.0)

The exception:

Invalid property 'businessPhones' specified in $select.
      Microsoft.Graph.Models.ODataErrors.ODataError: Exception of type 'Microsoft.Graph.Models.ODataErrors.ODataError' was thrown.
         at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.ThrowIfFailedResponse(HttpResponseMessage response, Dictionary`2 errorMapping, Activity activityForAttributes)
         at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory`1 factory, Dictionary`2 errorMapping, CancellationToken cancellationToken)
         at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory`1 factory, Dictionary`2 errorMapping, CancellationToken cancellationToken)
         at Microsoft.Graph.Groups.Item.Members.Item.GraphUser.GraphUserRequestBuilder.GetAsync(Action`1 requestConfiguration, CancellationToken cancellationToken)
andrueastman commented 1 year ago

There is a path missing in the metadata here. We would need to add a GET path to the metadata to '/groups/{group-id}/members/{directoryObject-id}/' which is missing at the moment.