我试图用 educationClass 模板在教育租户中创建一个团队,但没有结果,但实际上是使用Microsoft Graph SDK for C#。这是来自官方网站(https://docs.microsoft.com/es-es/graph/api/team-post?view=graph-rest-beta&tabs=csharp)推荐的带有BETA api的代码。
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var team = new Team
{
DisplayName = "My Sample Team",
Description = "My Sample Team’s Description",
AdditionalData = new Dictionary<string, object>()
{
{"template@odata.bind", "https://graph.microsoft.com/beta/teamsTemplates('educationClass')"},
{"owners@odata.bind", "[\"https://graph.microsoft.com/beta/users('userId')\"]"}
}
};
await graphClient.Teams
.Request()
.AddAsync(team);
当我执行此代码时,它将引发以下错误:Microsoft.Graph.ServiceException:'代码:BadRequest 消息:所有者在@ odata.bind中指定了无效的URL格式
谢谢!
答案 0 :(得分:1)
我找到了解决问题的办法。与其按照官方页面的建议在字符串中创建和数组,我使用了一个外部字符串数组:
Content