Im just starting with Microsoft Graph API and .net.
How can I add members and a team to a group using the latest Microsoft.Graph 1.13.0-preview nuget package (Microsoft Graph .NET Client Library)?
Can it be done in one request?
I was not able to set the Members, Owners or Team properties in the new Group statement.
Also I am not able to add a team to the newly created group (see last statement). The CreateAsync call does not return.
What am I doing wrong?
Group group = new Group
{
DisplayName = "Test Group",
Description = "description",
MailNickname = "testgroup",
Visibility = "Private",
MailEnabled = true,
SecurityEnabled = false,
GroupTypes = new List<string> { "Unified" },
Members = {} // not working,
Owners = {} // not working,
Team = {} // not working
};
var createdGroup = await graphClient.Groups.Request().AddAsync(group);
foreach (var item in groupMembers)
{
await raphClient.Groups[createdGroup.Id]
.Members.References.Request().AddAsync(item);
}
// not working
var createdTeam = await graphClient.Groups[createdGroup.Id]
.Team.Request().CreateAsync(new Team());
return createdGroup;