Microsoft Stream + Graph API

%3CLINGO-SUB%20id%3D%22lingo-sub-1756236%22%20slang%3D%22en-US%22%3EMicrosoft%20Stream%20%2B%20Graph%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1756236%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20beginning%20to%20explore%20the%20Graph%20API%20and%20how%20it%20will%20relate%20to%20the%20video%20files%20loaded%20into%20OneDrive%20%2F%20SharePoint.%20I%20really%20enjoy%20using%20the%20%3CA%20href%3D%22https%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fgraph-explorer%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EGraph%20Explorer%2C%3C%2FA%3E%26nbsp%3Bbut%20I'm%20struggling%20to%20find%20an%20example%20that%20will%20show%20the%20number%20of%20viewers%2C%20and%20the%20individuals%20that%20viewed%20the%20media%20as%20well.%20Does%20anyone%20have%20a%20sample%20GET%20command%20or%20code%20snippet%20that%20they%20can%20point%20me%20to%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22marekkoenig_0-1602106332091.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F224924iA3830929CAEC1836%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22marekkoenig_0-1602106332091.png%22%20alt%3D%22marekkoenig_0-1602106332091.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional 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.