| title | Create or replace an activityHistoryItem |
|---|---|
| description | Create a new or replace an existing history item for an existing user activity. |
| ms.localizationpriority | medium |
| ms.subservice | project-rome |
| author | ailae |
| doc_type | apiPageType |
| ms.date | 06/21/2024 |
Namespace: microsoft.graph
Create a new or replace an existing history item for an existing user activity.
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. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
[!INCLUDE permissions-table]
PUT /me/activities/{id}/historyItems/{id}{id} needs to be a GUID.
| Name | Type | Description |
|---|---|---|
| Authorization | string | Bearer {token}. Required. Learn more about authentication and authorization. |
In the request body, supply a JSON representation of an activityHistoryItem object.
If successful, this method returns a 201 Created response code if the activityHistoryItem was created or 200 OK if the activityHistoryItem was replaced.
The following example shows a request.
PUT https://graph.microsoft.com/v1.0/me/activities/{activity-id}/historyItems/{item-id}
Content-type: application/json
{
"startedDateTime": "2015-02-11T20:54:04.3457274+00:00",
"userTimezone": "Africa/Casablanca",
"lastActiveDateTime": "2015-02-11T20:54:04.3457274+00:00"
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('user%40contoso.com')/activities('13881113971988980728')/historyItems/$entity",
"status": "updated",
"userTimezone": "Africa/Casablanca",
"createdDateTime": "2018-02-26T20:28:22.14Z",
"lastModifiedDateTime": "2018-02-26T20:28:22.155Z",
"id": "9d0b74e4-4b41-43ea-b34d-f9c1bf9f809c",
"startedDateTime": "2018-02-26T20:54:04.345Z",
"lastActiveDateTime": "2018-02-26T20:54:24.345Z",
"expirationDateTime": "2018-03-28T20:28:22.14Z",
"activeDurationSeconds": 20
}