没有 MS MS 图形的 MS Teams API

Posted

技术标签:

【中文标题】没有 MS MS 图形的 MS Teams API【英文标题】:MS Teams API without MS MS Graph 【发布时间】: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 模型,你有一些教程来满足我的要求吗? 请参考此文档:docs.microsoft.com/en-us/graph/api/… 【参考方案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

【讨论】:

以上是关于没有 MS MS 图形的 MS Teams API的主要内容,如果未能解决你的问题,请参考以下文章

如何让 serverCallId 在 MS Teams 中启动通话录音?

MS Teams 活动源通知未到达移动设备

MS Teams:无法按用户将应用程序添加到 MS Teams

MS Graph API - 创建在线会议,不生成拨号会议信息。

SPFX Webpart 属性窗格在 MS Teams 个人选项卡中不可见

从我的 Flutter 应用加入 MS Teams 会议