【问题标题】:MS Teams API without MS MS Graph没有 MS MS 图形的 MS Teams API
【发布时间】:2022-01-24 03:48:48
【问题描述】:

我很想知道。有没有办法在触发某些事件的 MS 团队上创建自动聊天?

我假设 MS 团队中有一些 API,但我不知道它在哪里。

我有一些文章,为了满足我的要求,我们可以使用 MS 图。但在我去购买 MS Graph 许可证之前。

如果没有 MS Graph,有什么方法可以满足我的要求。

【问题讨论】:

  • 不,如果不使用Microsoft graph,就无法调用teams API
  • 您指的是什么 Microsoft Graph 许可证? Graph 是一个 API,它是免费的。您通过 Graph 使用的产品可能需要支付许可费。
  • @JohnHanley.. 谢谢你,让我大开眼界,我只知道几个免费的 MS Graph 模型,你有一些教程来满足我的要求吗?

标签: c# asp.net-mvc microsoft-teams webapi microsoft-graph-sdks


【解决方案1】:

在 MS 团队中,有一个名为“创建聊天”的 API 用于创建一对一聊天或群聊。调用此 API 需要以下权限之一:

委派(工作或学校帐户):Chat.Create、Chat.ReadWrite

创建一对一聊天:

POST https://graph.microsoft.com/v1.0/chats
Content-Type: application/json

{
  "chatType": "oneOnOne",
  "members": [
    {
      "@odata.type": "#microsoft.graph.aadUserConversationMember",
      "roles": ["owner"],
      "user@odata.bind": "https://graph.microsoft.com/v1.0/users('8b081ef6-4792-4def-b2c9-c363a1bf41d5')"
    },
    {
      "@odata.type": "#microsoft.graph.aadUserConversationMember",
      "roles": ["owner"],
      "user@odata.bind": "https://graph.microsoft.com/v1.0/users('82af01c5-f7cc-4a2e-a728-3a5df21afd9d')"
    }
  ]
}

创建群聊:

POST https://graph.microsoft.com/v1.0/chats
Content-Type: application/json

{
  "chatType": "group",
  "topic": "Group chat title",
  "members": [
    {
      "@odata.type": "#microsoft.graph.aadUserConversationMember",
      "roles": ["owner"],
      "user@odata.bind": "https://graph.microsoft.com/v1.0/users('8c0a1a67-50ce-4114-bb6c-da9c5dbcf6ca')"
    },
    {
      "@odata.type": "#microsoft.graph.aadUserConversationMember",
      "roles": ["owner"],
      "user@odata.bind": "https://graph.microsoft.com/v1.0/users('82fe7758-5bb3-4f0d-a43f-e555fd399c6f')"
    },
    {
      "@odata.type": "#microsoft.graph.aadUserConversationMember",
      "roles": ["owner"],
      "user@odata.bind": "https://graph.microsoft.com/v1.0/users('3626a173-f2bc-4883-bcf7-01514c3bfb82')"
    }
  ]
}

更多详情请参阅此文档:https://docs.microsoft.com/en-us/graph/api/chat-post?view=graph-rest-1.0&tabs=http

【讨论】:

    猜你喜欢
    • 2021-03-22
    • 1970-01-01
    • 2021-11-28
    • 1970-01-01
    • 2021-09-21
    • 2021-10-14
    • 1970-01-01
    • 1970-01-01
    • 2021-02-06
    相关资源
    最近更新 更多