【发布时间】:2019-06-24 17:45:48
【问题描述】:
我刚开始使用 Microsoft Graph API 和 .net。
如何使用最新的 Microsoft.Graph 1.13.0-preview nuget 包(Microsoft Graph .NET 客户端库)将成员和团队添加到组?
可以在一个请求中完成吗?
我无法在新组语句中设置成员、所有者或团队属性。
我也无法将团队添加到新创建的组中(请参阅最后一条声明)。 CreateAsync 调用不返回。
我做错了什么?
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;
【问题讨论】:
-
您将添加这样的团队:graphClient.Groups[groupPage[8].Id].Team.Request().PutAsync(team) 这将在下一个版本中提供。 github.com/microsoftgraph/msgraph-sdk-dotnet/pull/352
标签: c# .net microsoft-graph-api microsoft-teams