Forum Discussion

SHWork's avatar
SHWork
Copper Contributor
Aug 14, 2020

Add a User to a Group/Team with Graph

I know this is basic but I've been trying for hours to get this to work. The example in the docs is wrong. I want to add a user to a group/team. Here's the code at issue:

 

var group = new Group
{
AdditionalData = new Dictionary<string, object>()
{
{"@odata.id", "https://graph.microsoft.com/v1.0/users/{00000000-0000-0000-000000000000}"}
}
};
await graphClient.Groups["{00000000-0000-0000-0000-000000000000}"].Request().UpdateAsync(group);

 I feel like it's the odata part that I don't have right but I can't find an example that shows the correct format.

Resources