|
| 1 | +--- |
| 2 | +title: "Create contentActivity" |
| 3 | +toc.title: "Create contentActivity" |
| 4 | +description: "Create a content activity for the signed-in user." |
| 5 | +author: "ArunGedela" |
| 6 | +ms.date: 04/03/2025 |
| 7 | +ms.localizationpriority: medium |
| 8 | +ms.subservice: "security" |
| 9 | +doc_type: apiPageType |
| 10 | +--- |
| 11 | + |
| 12 | +# Create contentActivity |
| 13 | + |
| 14 | +Namespace: microsoft.graph |
| 15 | + |
| 16 | +[!INCLUDE [beta-disclaimer](../../includes/beta-disclaimer.md)] |
| 17 | + |
| 18 | +Create a content activity for the signed-in user. |
| 19 | + |
| 20 | +## Permissions |
| 21 | + |
| 22 | +Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions [only if your app requires it](/graph/permissions-overview#best-practices-for-using-microsoft-graph-permissions). For details about delegated and application permissions, see [Permission types](/graph/permissions-overview#permission-types). To learn more about these permissions, see the [permissions reference](/graph/permissions-reference). |
| 23 | + |
| 24 | +<!-- { |
| 25 | + "blockType": "permissions", |
| 26 | + "name": "activitiescontainer-post-contentactivities-permissions" |
| 27 | +} |
| 28 | +--> |
| 29 | +[!INCLUDE [permissions-table](../includes/permissions/activitiescontainer-post-contentactivities-permissions.md)] |
| 30 | + |
| 31 | +## HTTP request |
| 32 | + |
| 33 | +<!-- { |
| 34 | + "blockType": "ignored" |
| 35 | +} |
| 36 | +--> |
| 37 | +``` http |
| 38 | +POST /me/dataSecurityAndGovernance/activities/contentActivities |
| 39 | +``` |
| 40 | + |
| 41 | +## Request headers |
| 42 | + |
| 43 | +|Name|Description| |
| 44 | +|:---|:---| |
| 45 | +|Authorization|Bearer {token}. Required. Learn more about [authentication and authorization](/graph/auth/auth-concepts).| |
| 46 | +|Content-Type|application/json. Required.| |
| 47 | + |
| 48 | +## Request body |
| 49 | + |
| 50 | +In the request body, supply a JSON representation of the [contentActivity](../resources/contentactivity.md) object. |
| 51 | + |
| 52 | +## Response |
| 53 | + |
| 54 | +If successful, this method returns a `201 Created` response code and a [contentActivity](../resources/contentactivity.md) object in the response body. |
| 55 | + |
| 56 | +## Examples |
| 57 | + |
| 58 | +### Request |
| 59 | + |
| 60 | +The following example shows a request. |
| 61 | +# [HTTP](#tab/http) |
| 62 | +<!-- { |
| 63 | + "blockType": "request", |
| 64 | + "name": "create_contentactivity_from_" |
| 65 | +} |
| 66 | +--> |
| 67 | +``` http |
| 68 | +POST https://graph.microsoft.com/beta/me/dataSecurityAndGovernance/activities/contentActivities |
| 69 | +Content-Type: application/json |
| 70 | +
|
| 71 | +{ |
| 72 | + "contentMetadata": { |
| 73 | + "contentEntries": [ |
| 74 | + { |
| 75 | + "@odata.type": "microsoft.graph.processConversationMetadata", |
| 76 | + "identifier": "68fa951a-898a-4427-8e9e-6f8c05e9fe2b", |
| 77 | + "name":"API Explorer message", |
| 78 | + "correlationId": "559a2343-7aa2-4912-93fe-72c47b2706ed", |
| 79 | + "sequenceNo": 0, |
| 80 | + "isTruncated": false, |
| 81 | + "createdDateTime": "2025-04-28T20:17:55", |
| 82 | + "modifiedDateTime": "2025-04-28T20:17:55" |
| 83 | + } |
| 84 | + ], |
| 85 | + "activityMetadata": { |
| 86 | + "activity": "uploadText" |
| 87 | + }, |
| 88 | + "deviceMetadata": { |
| 89 | + "deviceType": "unmanaged", |
| 90 | + "operatingSystemSpecifications": { |
| 91 | + "operatingSystemPlatform": "Windows 11", |
| 92 | + "operatingSystemVersion": "10.0.26100.0" |
| 93 | + } |
| 94 | + }, |
| 95 | + "integratedAppMetadata": { |
| 96 | + "name": "API Explorer", |
| 97 | + "version": "0.1" |
| 98 | + }, |
| 99 | + "userId":"7c2f8f10-cba8-4a8d-9449-db4b76d17390", |
| 100 | + "scopeIdentifier":"0" |
| 101 | + } |
| 102 | +} |
| 103 | +``` |
| 104 | + |
| 105 | +# [C#](#tab/csharp) |
| 106 | +[!INCLUDE [sample-code](../includes/snippets/csharp/create-contentactivity-from--csharp-snippets.md)] |
| 107 | +[!INCLUDE [sdk-documentation](../includes/snippets/snippets-sdk-documentation-link.md)] |
| 108 | + |
| 109 | +# [CLI](#tab/cli) |
| 110 | +[!INCLUDE [sample-code](../includes/snippets/cli/create-contentactivity-from--cli-snippets.md)] |
| 111 | +[!INCLUDE [sdk-documentation](../includes/snippets/snippets-sdk-documentation-link.md)] |
| 112 | + |
| 113 | +# [Go](#tab/go) |
| 114 | +[!INCLUDE [sample-code](../includes/snippets/go/create-contentactivity-from--go-snippets.md)] |
| 115 | +[!INCLUDE [sdk-documentation](../includes/snippets/snippets-sdk-documentation-link.md)] |
| 116 | + |
| 117 | +# [Java](#tab/java) |
| 118 | +[!INCLUDE [sample-code](../includes/snippets/java/create-contentactivity-from--java-snippets.md)] |
| 119 | +[!INCLUDE [sdk-documentation](../includes/snippets/snippets-sdk-documentation-link.md)] |
| 120 | + |
| 121 | +# [JavaScript](#tab/javascript) |
| 122 | +[!INCLUDE [sample-code](../includes/snippets/javascript/create-contentactivity-from--javascript-snippets.md)] |
| 123 | +[!INCLUDE [sdk-documentation](../includes/snippets/snippets-sdk-documentation-link.md)] |
| 124 | + |
| 125 | +# [PHP](#tab/php) |
| 126 | +[!INCLUDE [sample-code](../includes/snippets/php/create-contentactivity-from--php-snippets.md)] |
| 127 | +[!INCLUDE [sdk-documentation](../includes/snippets/snippets-sdk-documentation-link.md)] |
| 128 | + |
| 129 | +# [Python](#tab/python) |
| 130 | +[!INCLUDE [sample-code](../includes/snippets/python/create-contentactivity-from--python-snippets.md)] |
| 131 | +[!INCLUDE [sdk-documentation](../includes/snippets/snippets-sdk-documentation-link.md)] |
| 132 | + |
| 133 | +--- |
| 134 | + |
| 135 | +### Response |
| 136 | + |
| 137 | +The following example shows the response. |
| 138 | +>**Note:** The response object shown here might be shortened for readability. |
| 139 | +<!-- { |
| 140 | + "blockType": "response", |
| 141 | + "truncated": true, |
| 142 | + "@odata.type": "microsoft.graph.contentActivity" |
| 143 | +} |
| 144 | +--> |
| 145 | +``` http |
| 146 | +HTTP/1.1 201 Created |
| 147 | +Content-Type: application/json |
| 148 | +
|
| 149 | +{ |
| 150 | + "@odata.type": "#microsoft.graph.contentActivity", |
| 151 | + "id": "420c8b9c-f4d7-4aa8-a392-344b3af9aa83", |
| 152 | + "userId": "7c2f8f10-cba8-4a8d-9449-db4b76d17390", |
| 153 | + "scopeIdentifier": null, |
| 154 | + "contentMetadata": { |
| 155 | + "protectedAppMetadata": null, |
| 156 | + "contentEntries": [ |
| 157 | + { |
| 158 | + "identifier": "68fa951a-898a-4427-8e9e-6f8c05e9fe2b", |
| 159 | + "content": null, |
| 160 | + "name": "API Explorer message", |
| 161 | + "correlationId": "559a2343-7aa2-4912-93fe-72c47b2706ed", |
| 162 | + "sequenceNumber": null, |
| 163 | + "length": null, |
| 164 | + "isTruncated": false, |
| 165 | + "createdDateTime": "2025-04-28T20:17:55Z", |
| 166 | + "modifiedDateTime": "2025-04-28T20:17:55Z" |
| 167 | + } |
| 168 | + ], |
| 169 | + "activityMetadata": { |
| 170 | + "activity": "downloadText" |
| 171 | + }, |
| 172 | + "deviceMetadata": { |
| 173 | + "deviceType": "unmanaged", |
| 174 | + "operatingSystemSpecifications": { |
| 175 | + "operatingSystemPlatform": "Windows 11", |
| 176 | + "operatingSystemVersion": "10.0.26100.0" |
| 177 | + } |
| 178 | + }, |
| 179 | + "integratedAppMetadata": { |
| 180 | + "name": "API Explorer", |
| 181 | + "version": "0.1" |
| 182 | + } |
| 183 | + } |
| 184 | +} |
| 185 | +``` |
0 commit comments