Microsoft 365 Copilot 交互 & Microsoft 365 Chat

Copilot 活动导出 API 允许导出 Copilot 交互数据,其中包括用户提示 Copilot 和 Copilot 响应。 此 API 捕获用户意向和 Copilot 访问的资源,以及跨 Microsoft 365 Copilot 应用(如 Teams、Word 和 Outlook)向用户做出的响应。

如何访问 Copilot 活动导出 API

  • 示例 1 是一个简单的查询,用于检索所有没有筛选器的副驾驶交互:

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

    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 交互
  • 访问新的 Copilot 活动导出 API 需要 Microsoft 365 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

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

详细了解 aiInteractionHistory: getAllEnterpriseInteractions ,它支持导出 copilot 交互。

已知问题:

对于 Teams 会议 Copilot 中的某些交互, contexts[] 交互中 aiResponse 可能缺少 。 但是,相应的用户提示始终包括 以确保 contexts[] 准确的上下文检索。 开发团队已意识到此问题,并正在努力解决问题。 以下示例显示了 userprompt、aiResponse 对,该对在 userprompt 中具有有效的上下文[],在相应的 aiResponse 中缺少上下文[]。

[
    {
        "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 的限制限制,请参阅 Teams 导出 API 限制
  • 不支持 Delta 函数调用。
  • 为了获得最佳性能,建议的$top值为 100。
  • 此 API 可用于检索已删除用户的支持的 Copilot 交互。
  • 可以使用此 API 检索受支持应用类的已删除 copilot 交互。
  • 如果编辑了用户提示,则会将其视为新的交互,并可以使用此 API 进行检索。