Microsoft Stream + Graph API

Brass Contributor

I'm beginning to explore the Graph API and how it will relate to the video files loaded into OneDrive / SharePoint. I really enjoy using the Graph Explorer, but I'm struggling to find an example that will show the number of viewers, and the individuals that viewed the media as well. Does anyone have a sample GET command or code snippet that they can point me to?

 

marekkoenig_0-1602106332091.png

 

1 Reply

@marekkoenig 

I think what you're looking for is this

https://docs.microsoft.com/en-us/graph/api/itemanalytics-get?view=graph-rest-beta&tabs=http 

There is quite a bit of code around using the SharePoint API but the numbers it reports are from SharePoint Search so are slightly different (reference).

I haven't been able to find a code example for you I'm afraid.

Update 

I've just found the following which talks about the GraphApi analytics for specific list item (file) giving the actorCount, actionCount
https://www.drware.com/how-to-retrieve-analytics-information-for-pages-in-the-site-pages-using-graph...

This lead me to

https://docs.microsoft.com/en-us/graph/api/itemanalytics-get?view=graph-rest-1.0&tabs=http

for the basic analytics and then 

the following which gives these values for a specific interval

https://docs.microsoft.com/en-us/graph/api/itemactivitystat-getactivitybyinterval?view=graph-rest-1....

 

I think with this and the PostMan tool getting a GraphApi token for authentication, should give you (and me now) enough to get analytics for specific files.