我正在尝试通过 Microsoft 图形 API 访问 Teams-Ressourcec。我似乎撞墙了。该应用具有所需的权限(如 MS 文档中所列)
我尝试过的查询: 一个简单的获取:
string querystring = "api-version=1.6";
var uri = "https://graph.windows.net/contoso.onmicrosoft.com/teams/" + TeamID+ "/channels?" + querystring;
Console.WriteLine(uri);
HTTPClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", result);
var GetResult = await HTTPClient.GetAsync(uri);
此方法适用于 Graph Explorer (v1.0) 中的委派权限,但它使用委派用户权限,而不是应用权限。
迁移团队反应的 POST:
string querystring = "api-version=1.6";
var uri = "https://graph.windows.net/contoso.onmicrosoft.com/teams?" + querystring;
HTTPClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
HttpRequestMessage Content = new HttpRequestMessage();
Content.Content = new StringContent("{ \"@microsoft.graph.teamCreationMode\": \"migration\", \"template@odata.bind\": \"https://graph.microsoft.com/v1.0/teamsTemplates('standard')\", \"displayName\": \"My Sample Migration Team\", \"description\": \"\", \"createdDateTime\": \"2020-03-14T11:22:17.043Z\" }", Encoding.UTF8, "application/json");
var GetResult = await HTTPClient.PostAsync(uri, Content.Content);
对于这两种情况,我都收到“找不到“团队”部分的资源。 有人看过吗?如何通过 Graph API 访问\使用 Teams 资源?
答案 0 :(得分:0)
当您调用 https://graph.windows.net 时,这是 Azure AD Graph,它已弃用,将于 2022 年 6 月 30 日停用。
我建议您改用 Microsoft Graph,您称之为 https://graph.microsoft.com/version。请参阅 Graph Explorer 以开始使用。
查看 List Channels 以了解如何使用 MS Graph 列出团队频道。