Reputation: 553
What is the correct way to remove a member from a group using the Microsoft Graph .NET Client Library?
Adding a member can be done like this:
client.Groups["groupid"].Members.References.Request().AddAsync(objToAdd);
So i expected that there is something like:
client.Groups["groupid"].Members.References.Request().RemoveAsync(objToRemove);
The same question also applies to client.Groups["groupid"].Owners.References.
Upvotes: 4
Views: 4787
Reputation: 4680
Try this way:
client.Groups["group_id"].Members["member_id"].Reference.Request().DeleteAsync();
The API to remove a member is:
DELETE /groups/<id>/members/<id>/$ref
The DirectoryObjectReferenceRequest.DeleteAsync() method will use DELETE method to send the request.
Upvotes: 9