Reputation: 1
Unable to cast object of type 'Microsoft.Graph.GroupMembersCollectionWithReferencesPage' to type 'Microsoft.Graph.Group'.
Please give me any solution , I got above error when I try to fetch azure group members by using Microsoft graph API. I used this namespace (using Group = Microsoft.Graph.Group;) var members = (Group)teamClient.Groups[itemmembers.Id].Members.Request().GetAsync().Result;
What i need to do to fix it , u need to configure my azure portal settings or i need to modify azure function code
Upvotes: 0
Views: 385
Reputation: 728
It looks like you may be using a TeamClient object instead of a GraphServiceClient object. This is how to get it with a GraphServiceClient object:
GraphServiceClient graphClient = new GraphServiceClient(authProvider);
var members = await graphClient.Groups["{group-id}"].Members.Request()
.GetAsync().GetAwaiter().GetResult();
Upvotes: 0