Forum Discussion
Marc Mroz
Microsoft
Sep 22, 2020Learn about the new Microsoft Stream - enhancing video across M365 built on top of SharePoint
We have some really exciting news to share about the new Microsoft Stream. Many of your requests, feedback, and suggestions have gone into this new change. We think we'll be able to move much faster ...
marekkoenig
Oct 07, 2020Brass Contributor
Great stuff, happy to see that there are some needed improvements to the platform. I'm most excited about the ability to use the API to query files and built out some deeper analytics.
Can someone provide either a sample GET command or a snippet on how to retrieve view information for a file stored in OneDrive?
Marc Mroz
Microsoft
Nov 10, 2020
marekkoenig wrote:
Great stuff, happy to see that there are some needed improvements to the platform. I'm most excited about the ability to use the API to query files and built out some deeper analytics.
Can someone provide either a sample GET command or a snippet on how to retrieve view information for a file stored in OneDrive?
marekkoenig - You can use the /getActivitiesByInterval API: Get item activity stats by interval - Microsoft Graph v1.0 | Microsoft Docs
Example GET:
https://graph.microsoft.com/v1.0/me/drive/items/01AY6ADJYACCEFNHXAUJAKUQV4MY7MHFKB/getActivitiesByInterval(startDateTime='2020-08-26',endDateTime='2020-09-01',interval='week')
Will return this, 50 views in this time frame from 29 unique users.
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(itemActivityStat)",
"value": [
{
"@odata.type": "#microsoft.graph.itemActivityStat",
"aggregationInterval": "None",
"startDateTime": "2020-08-26T00:00:00Z",
"endDateTime": "2020-09-01T23:59:59Z",
"access": {
"actionCount": 50,
"actorCount": 29,
"timeSpentInSeconds": 0
},
"incompleteData": {
"wasThrottled": false,
"resultsPending": false,
"notSupported": false
}
}
]
}