创建 contentActivity

命名空间:microsoft.graph

为已登录用户创建 内容活动 。

此 API 可用于以下国家级云部署。

全局服务 美国政府 L4 美国政府 L5 (DOD) 由世纪互联运营的中国
✅ ✅ ✅ ❌

权限

为此 API 选择标记为最低特权的权限。 只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。

权限类型 最低特权权限 更高特权权限
委派(工作或学校帐户) ContentActivity.Write 不可用。
委派(个人 Microsoft 帐户) 不支持。 不支持。
应用程序 ContentActivity.Write 不可用。

HTTP 请求

POST /me/dataSecurityAndGovernance/activities/contentActivities

注意

调用 /me 终结点需要已登录的用户,因此需要委派权限。 使用 /me 终结点时,不支持应用程序权限。

POST /users/{userId}/dataSecurityAndGovernance/activities/contentActivities

请求标头

名称 说明
Authorization 持有者 {token}。 必填。 详细了解 身份验证和授权。
Content-Type application/json. 必需。

请求正文

在请求正文中,提供 contentActivity 对象的 JSON 表示形式。

响应

如果成功,此方法在响应正文中返回响应 201 Created 代码和 contentActivity 对象。

示例

请求

以下示例显示了一个请求。

POST https://graph.microsoft.com/v1.0/me/dataSecurityAndGovernance/activities/contentActivities
Content-Type: application/json

{
    "contentToProcess": {
       "contentEntries": [
          {
             "@odata.type": "microsoft.graph.processConversationMetadata",
             "identifier": "07785517-9081-4fe7-a9dc-85bcdf5e9075",
             "name":"PC Purview API Explorer message",
             "correlationId": "d63eafd2-e3a9-4c1a-b726-a2e9b9d9580d",
             "sequenceNumber": 0, 
             "isTruncated": false,
             "createdDateTime": "2025-05-27T17:23:20",
             "modifiedDateTime": "2025-05-27T17:23:20"
          }
       ],
       "activityMetadata": { 
          "activity": "uploadText"
       },
       "deviceMetadata": {
          "operatingSystemSpecifications": {
             "operatingSystemPlatform": "Windows 11",
             "operatingSystemVersion": "10.0.26100.0" 
          },
          "ipAddress": "127.0.0.1"
       },
       "protectedAppMetadata": {
          "name": "PC Purview API Explorer",
          "version": "0.2",
          "applicationLocation":{
             "@odata.type": "microsoft.graph.policyLocationApplication",
             "value": "83ef208a-0396-4893-9d4f-d36efbffc8bd"
          }
       },
       "integratedAppMetadata": {
          "name": "PC Purview API Explorer",
          "version": "0.2" 
       }
    }
}

响应

以下示例显示了相应的响应。

注意:为了提高可读性,可能缩短了此处显示的响应对象。

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('7c497f10-cba8-4a8d-9449-db4b76d1ef80')/dataSecurityAndGovernance/activities/contentActivities/$entity",
  "id": "4c3d1219-b1af-442f-85b5-06b7ef1cf8c8",
  "userId": "7c497f10-cba8-4a8d-9449-db4b76d1ef80",
  "scopeIdentifier": null,
  "contentMetadata": {
    "protectedAppMetadata": null,
    "contentEntries": [
      {
        "identifier": "d6ab5054-e111-45c3-9fba-9f2a59c9bbf8",
        "content": null,
        "name": "CA Purview API Explorer message",
        "correlationId": "edfb7f88-b963-4ef2-8b30-5cb90f80e01e",
        "sequenceNumber": 0,
        "length": null,
        "isTruncated": false,
        "createdDateTime": "2025-05-28T20:20:37Z",
        "modifiedDateTime": "2025-05-28T20:20:37Z"
      }
    ],
    "activityMetadata": {
      "activity": "downloadText"
    },
    "deviceMetadata": {
      "deviceType": null,
      "operatingSystemSpecifications": {
        "operatingSystemPlatform": "Windows 11",
        "operatingSystemVersion": "10.0.26100.0"
      }
    },
    "integratedAppMetadata": {
      "name": "CA Purview API Explorer",
      "version": "0.1"
    }
  }
}