| title | List used (deprecated) |
|---|---|
| description | Calculate and list the documents the user has viewed or modified. |
| author | simonhult |
| ms.localizationpriority | medium |
| ms.subservice | insights |
| doc_type | apiPageType |
| ms.date | 04/05/2024 |
Namespace: microsoft.graph
[!INCLUDE beta-disclaimer]
Caution
The /insights/used API is deprecated and will stop returning data after November 2026.
Calculate and list the documents that a user has viewed or modified.
For the signed-in user:
- This method includes documents that the user has modified; see example 1.
- Using an
$orderbyquery parameter on the lastAccessedDateTime property returns the most recently viewed documents that the user might or might not have modified; see example 2.
For other users, this method includes only documents that the user has modified.
[!INCLUDE national-cloud-support]
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]
-
Get a list of documents that the signed-in user has modified:
GET /me/insights/used
-
Get a list of documents that the specified user has modified:
GET /users/{id | userPrincipalName}/insights/used
Note: Requesting another user's used documents returns results sorted by lastModifiedDateTime. lastAccessedDateTime is then set to lastModifiedDateTime.
-
Expand the resource referenced by a used insight:
GET /me/insights/used/{id}/resource GET /users/{id | userPrincipalName}/insights/used/{id}/resource
This method supports the OData query parameters to help customize the response:
-
Use the
$filterquery parameter to filter used items. For example, based on type:https://graph.microsoft.com/beta/me/insights/used?$filter=ResourceVisualization/Type eq 'PowerPoint' -
Use
$filterto filter used items based on containerType:https://graph.microsoft.com/beta/me/insights/used?$filter=ResourceVisualization/containerType eq 'OneDriveBusiness'See the available container types and types you can filter by in resourceVisualization.
-
Use the
$orderbyquery parameter to sort documents last viewed or modified by the signed-in user, based on the lastAccessedDateTime property:https://graph.microsoft.com/beta/me/insights/used?$orderby=LastUsed/LastAccessedDateTime descNote: Use this query option only for the signed-in user. You cannot use this API to get documents viewed or modified by another user. See example 2.
| Header | Value |
|---|---|
| Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
| Accept | application/json |
Don't supply a request body for this method.
If successful, this method returns a 200 OK response code and a list of used items in the response body.
If item insights of targeted user have been disabled, this method returns 403 Forbidden and the following error:
{
"error": {
"code": "ItemInsightsDisabled",
"message": " The access to the requested resource is denied because item insights are disabled.",
"innerError": {
"requestId": "request-id",
"date": "date-time"
}
}
}
For more details, see customize insights privacy.
GET https://graph.microsoft.com/beta/me/insights/used
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('c74dcd16-d8af-4df8-9621-d123b58de3e6')/insights/used",
"value": [
{
"id": "Abk3ZeZmlghMhUVKP9mygDoPEPUbLediT7xb7UyGkIkmjsvR4JlgRUGA28jNM6INA5k5RvS1T4tPmZSWjFY1PFu5N2XmZpYITIVFSj_ZsoA6BQ",
"lastUsed": {
"lastAccessedDateTime": "2019-05-25T07:12:38Z",
"lastModifiedDateTime": "2019-05-25T07:12:37Z"
},
"resourceVisualization": {
"title": "Org Chart",
"type": "Visio",
"mediaType": "application/vnd.visio",
"previewImageUrl": "https://contoso.sharepoint.com/_api/v2.0/drives/b!uTdl5maWCEyFRUo_2bKAOg8Q9Rst52JPvFvtTIaQiSaOy9HgmWBFQYDbyM0zog0D/items/01JSNPH6EZHFDPJNKPRNHZTFEWRRLDKPC3/thumbnails/0/small/thumbnailContent",
"previewText": "Page-1",
"containerWebUrl": "https://contoso.sharepoint.com/sites/Retail/Shared Documents/NC460 Sales",
"containerDisplayName": "Retail",
"containerType": "Site"
},
"resourceReference": {
"webUrl": "https://contoso.sharepoint.com/sites/Retail/_layouts/15/Doc.aspx?sourcedoc=%7BF4463999-4FB5-4F8B-9994-968C56353C5B%7D&file=Org%20Chart.vsdx&action=default&DefaultItemOpen=1",
"id": "drives/b!uTdl5maWCEyFRUo_2bKAOg8Q9Rst52JPvFvtTIaQiSaOy9HgmWBFQYDbyM0zog0D/items/01JSNPH6EZHFDPJNKPRNHZTFEWRRLDKPC3",
"type": "microsoft.graph.driveItem"
}
}
]
}Example 2: Return the most recently viewed documents that the signed-in user might or might not have modified
GET https://graph.microsoft.com/beta/me/insights/used?$orderby=LastUsed/LastAccessedDateTime desc
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#users('c74dcd16-d8af-4df8-9621-d123b58de3e6')/insights/used",
"value": [
{
"id": "AWTmrUBYzTxMsvtILkUktIaN-sDnMnRRTYqBxeih4bUUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABk5q1AWM08TLL7SC5FJLSGBA",
"lastUsed": {
"lastAccessedDateTime": "2020-03-16T13:31:55Z",
"lastModifiedDateTime": "0001-01-01T00:00:00Z"
},
"resourceVisualization": {
"title": "Executive Corner",
"type": "spsite",
"mediaType": "application/octet-stream",
"previewImageUrl": "https://contoso.sharepoint.com/_api/v2.0/drives/b!ZOatQFjNPEyy-0guRSS0ho36wOcydFFNioHF6KHhtRQAAAAAAAAAAAAAAAAAAAAA/items/01NTE4NPQAAAAAAAAAAAAAAAAAAAAAAAAA/thumbnails/0/small/thumbnailContent",
"previewText": "",
"containerDisplayName": "Executive Corner",
"containerType": "Site"
},
"resourceReference": {
"webUrl": "https://contoso.sharepoint.com/sites/Exec",
"id": "sites/contoso.sharepoint.com,40ade664-cd58-4c3c-b2fb-482e4524b486,e7c0fa8d-7432-4d51-8a81-c5e8a1e1b514",
"type": "microsoft.graph.siteItem"
}
}
]
}