Microsoft Copilot交互 & Microsoft 365 Chat

借助 Copilot 活动导出 API 可以导出 Copilot 交互数据,其中包括向 Copilot 发送的用户提示以及将 Copilot 响应返回给用户。 此 API 捕获用户意图和 Copilot 访问的资源,并在 Microsoft Copilot 应用(如 Teams、Word 和 Outlook)中将响应返回给用户。

如何访问 Copilot 活动导出 API

  • 示例 1 是一个简单查询,用于检索所有 Copilot 交互,无需任何筛选器:

    GET https://graph.microsoft.com/v1.0/copilot/users/{id}/interactionHistory/getAllEnterpriseInteractions 
    
  • 示例 2 是一个简单查询,用于检索所有 Copilot 与 appclass 筛选器的交互:

    GET https://graph.microsoft.com/v1.0/copilot/users/{id}/interactionHistory/getAllEnterpriseInteractions?$filter=appClass eq 'IPM.SkypeTeams.Message.Copilot.Teams or appClass eq 'IPM.SkypeTeams.Message.Copilot.BizChat'
    

访问 Copilot 活动导出 API 的先决条件

应用程序权限由在没有登录用户的情况下运行的应用使用。 只有管理员才能批准应用程序权限。 需要以下权限:

  • AiEnterpriseInteraction.Read.All:允许跨 Microsoft 365 应用和 Microsoft 365 Chat 访问所有 Copilot 交互
  • 访问新的 Microsoft Copilot 活动导出 API 需要 Microsoft Copilot 许可证。

支持的 appClass 筛选器

支持以下 appClass 筛选器:

  • IPM.SkypeTeams.Message.Copilot.Word

  • IPM.SkypeTeams.Message.Copilot.Excel

  • IPM.SkypeTeams.Message.Copilot.Teams

  • IPM.SkypeTeams.Message.Copilot.BizChat

  • IPM.SkypeTeams.Message.Copilot.WebChat

  • IPM.SkypeTeams.Message.Copilot.CoworkChat

这些筛选器允许你指定要根据应用类检索的 Copilot 交互的类型。 不支持其余交互。

详细了解启用导出 Copilot 交互的 aiInteractionHistory: getAllEnterpriseInteractions 。

已知问题

对于 Teams 会议 Copilot 中的某些交互,交互中aiResponse可能缺少。contexts[] 但是,相应的用户提示始终包含 , contexts[] 以确保准确的上下文检索。 开发团队已意识到此问题,并正在研究解决方案。 下面的示例演示了一个 userPrompt 和 aiResponse 对,该对在 userPrompt 中具有有效的 contexts[],而在相应的 aiResponse 中缺少 contexts[]。

[
    {
        "id": "1746757256660",
        "sessionId": "19:-SMwOyVjy2H3_BnsIO6WGUTXwuN1_BIw4U2TP4UcCwo1@thread.v2",
        "requestId": "db42bee0-7cfb-451f-8eb6-f929762ee970",
        "appClass": "IPM.SkypeTeams.Message.Copilot.Teams",
        "interactionType": "userPrompt",
        "conversationType": "appchat",
        "etag": "1746757256660",
        "createdDateTime": "2025-05-09T02:20:56.66Z",
        "locale": "en-us",
        "contexts": [
            {
                "contextReference": "https://microsoft.teams.com/threads/19:meeting_MTQ4ZDdkMzktYjhkZC00ODdlLTkwN2UtYzcwYjVmOWIxYTNm@thread.v2",
                "displayName": "Teams Meeting Copilot",
                "contextType": "TeamsMeeting"
            }
        ],
        "from": {
            "@odata.type": "#microsoft.graph.chatMessageFromIdentitySet",
            "application": null,
            "device": null,
            "user": {
                "@odata.type": "#microsoft.graph.teamworkUserIdentity",
                "id": "886cb6c8-eb73-4f72-ad99-69ebf43f70ad",
                "displayName": "8:orgid:886cb6c8-eb73-4f72-ad99-69ebf43f70ad",
                "userIdentityType": "aadUser",
                "tenantId": "bcefad10-7e12-4123-8457-f3ac71b098db"
            }
        },
        "body": {
            "contentType": "text",
            "content": "what was this meeting about?<attachment id=\"19:meeting_MTQ4ZDdkMzktYjhkZC00ODdlLTkwN2UtYzcwYjVmOWIxYTNm@thread.v2\"></attachment>"
        },
        "attachments": [
            {
                "attachmentId": "19:meeting_MTQ4ZDdkMzktYjhkZC00ODdlLTkwN2UtYzcwYjVmOWIxYTNm@thread.v2",
                "contentType": "reference",
                "contentUrl": "https://microsoft.teams.com/threads/19:meeting_MTQ4ZDdkMzktYjhkZC00ODdlLTkwN2UtYzcwYjVmOWIxYTNm@thread.v2",
                "content": null,
                "name": "Teams Meeting Copilot"
            }
        ],
        "links": [],
        "mentions": []
    },
    {
        "id": "1746757257162",
        "sessionId": "19:-SMwOyVjy2H3_BnsIO6WGUTXwuN1_BIw4U2TP4UcCwo1@thread.v2",
        "requestId": "db42bee0-7cfb-451f-8eb6-f929762ee970",
        "appClass": "IPM.SkypeTeams.Message.Copilot.Teams",
        "interactionType": "aiResponse",
        "conversationType": "appchat",
        "etag": "1746757257162",
        "createdDateTime": "2025-05-09T02:20:57.162Z",
        "locale": "en-us",
        "contexts": [],
        "from": {
            "@odata.type": "#microsoft.graph.chatMessageFromIdentitySet",
            "device": null,
            "user": null,
            "application": {
                "@odata.type": "#microsoft.graph.teamworkApplicationIdentity",
                "id": "fb8d773d-7ef8-4ec0-a117-179f88add510",
                "displayName": "Copilot in Teams",
                "applicationIdentityType": "bot"
            }
        },
        "body": {
            "contentType": "text",
            "content": "I need to hear more discussion before I can get to work. Please try again in a few minutes."
        },
        "attachments": [],
        "links": [],
        "mentions": []
    }
]

不在 Copilot 交互范围内 导出 API:

  • 不支持 Delta 函数调用。
  • Copilot 交互导出 API 响应中不包括某些 Copilot 生成的演示文稿元数据。 不包括以下元数据:
    1. 可编辑的 Copilot Microsoft 365 聊天显示名称。
    2. Copilot 自动生成或建议的 Outlook 邮件主题行。

注意

  • 若要了解 Copilot 交互导出 API 的限制,请参阅 Teams 导出 API 限制。
  • 为了获得最佳性能,建议的$top值为 100。
  • 此 API 可用于检索已删除用户支持的 Copilot 交互。
  • 可以使用此 API 检索已删除的受支持应用类的 Copilot 交互。
  • 如果编辑了用户提示,则它将被视为新交互,可以使用此 API 进行检索。