使用图形 API 以编程方式将应用程序添加到频道

问题描述 投票:0回答:1

我想使用图形 API 将选项卡应用程序安装到团队内的特定频道。相关的文档似乎只包括将应用程序添加到团队本身,而不是特定的渠道。但是,从 Microsoft Teams UI 看来我可以做到这一点。

我试图做一个天真的请求:

https://graph.microsoft.com/v1.0/teams/{{team_id}}/channel/{{channel_id}}/installedApps

这模仿了团队使用标准约定对特定通道进行其他 API 调用的工作流程,但没有成功。

我还尝试通过以下方式添加它:

https://graph.microsoft.com/v1.0/teams/{teamId}/channels/{channelId}/tabs

带有请求正文:

{
  "displayName": "Your App Tab Display Name",
  "teamsAppId": "YourAppId",
  "configuration": {
    "entityId": "YourEntityId",
    "contentUrl": "YourContentUrl",
    "websiteUrl": "YourWebsiteUrl"
  }
}

但它返回 500 错误。

microsoft-graph-api microsoft-teams azure-ad-graph-api microsoft-graph-teams
1个回答
0
投票

我的 Teams 组中有一个名为

General
的频道,可以使用以下图形 API 调用进行检索:

GET https://graph.microsoft.com/v1.0/teams/{teamId}/channels/{channelId}/

回复:

enter image description here

最初,您可以调用下面的 Graph API 查询来获取 Forms

 应用程序的 
teamsAppId

GET https://graph.microsoft.com/v1.0/appCatalogs/teamsApps?$filter=displayName+eq+'Forms'

回复:

enter image description here

要将选项卡应用程序安装到团队内的特定频道,我运行了图形请求并得到了响应,如下所示:

POST https://graph.microsoft.com/v1.0/teams/{teamId}/channels/{channelId}/tabs

{
    "displayName": "Forms Tab App",
    "[email protected]": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{AppId_from_above_response}",
    "configuration": {
        "entityId": "YourEntityId",
        "contentUrl": "YourContentUrl",
        "websiteUrl": "YourWebsiteUrl"
    }
}

回复:

enter image description here

为了确认,我在 Teams 中检查了相同的内容,其中选项卡应用程序已成功添加到通道,如下所示:

enter image description here

参考: 将选项卡添加到频道 - Microsoft Graph

© www.soinside.com 2019 - 2024. All rights reserved.