historyItem resource type

Namespace: microsoft.graph

Represents a history item for an activity in an app. User activities represent a single destination within your app; for example, a TV show, a document, or a current campaign in a video game. When a user engages with that activity, the engagement is captured as a history item that indicates the start and end time for that activity. As the user re-engages with that activity over time, multiple history items are recorded for a single user activity.

When an app creates a session, a historyItem object should be added to the activity object to reflect the period of user engagement. Each time a user re-engages with an activity, a new historyItem is added to the activity to accrue user engagement.


Method Return Type Description
Create or replace historyItem historyItem Create or replace an existing historyItem for that activity (upsert). The ID needs to be a GUID.
Delete a historyItem No Content Delete the specified historyItem for that activity.


Name Type Description
activeDurationSeconds int Optional. The duration of active user engagement. if not supplied, this is calculated from the startedDateTime and lastActiveDateTime.
createdDateTime DateTimeOffset Set by the server. DateTime in UTC when the object was created on the server.
expirationDateTime DateTimeOffset Optional. UTC DateTime when the historyItem will undergo hard-delete. Can be set by the client.
id String Required. Client-set GUID for the historyItem object.
lastActiveDateTime DateTimeOffset Optional. UTC DateTime when the historyItem (activity session) was last understood as active or finished - if null, historyItem status should be Ongoing.
lastModifiedDateTime DateTimeOffset Set by the server. DateTime in UTC when the object was modified on the server.
startedDateTime DateTimeOffset Required. UTC DateTime when the historyItem (activity session) was started. Required for timeline history.
status status Set by the server. A status code used to identify valid objects. Values: active, updated, deleted, ignored.
userTimezone String Optional. The timezone in which the user's device used to generate the activity was located at activity creation time. Values supplied as Olson IDs in order to support cross-platform representation.


Relationship Type Description
activity userActivity Optional. NavigationProperty/Containment; navigation property to the associated activity.

JSON representation

The following is a JSON representation of the resource.

    "createdDateTime": "DateTimeOffset",
    "expirationDateTime": "DateTimeOffset",
    "id": "String",
    "lastActiveDateTime": "DateTimeOffset",
    "lastModifiedDateTime": "DateTimeOffset",
    "startedDateTime": "DateTimeOffset",
    "status": "String",
    "userTimezone": "String"