In addition to exposing users’ data, like who they are and what content they work with (files, messages, conversations, tasks, etc.), the Microsoft Graph also exposes calculated insights based on the users’ activity. These insights enable applications to get to relevant data about users. For example, using the Trending API to get documents that are trending or using the People API to get people they closely work with.
Today we are announcing an improvement in our Trending API based on feedback we received from our developer community. This API returns documents that are relevant to users in their organization. The Trending API was initially exposed under the /trendingAround navigation on any user in the beta endpoint. We are removing this navigation over the next few months and the improved version of the Trending API is now available under a new navigation: /insights/trending.
This improved Trending API returns not only the list of relevant documents but also new visualization properties that let you render the documents in your app experiences as cards, the same way we do in Office 365, for example in Delve. And it also returns reference properties, that enable navigations to the actual documents.
The Trending API uses an intelligent background analysis to deliver the most relevant documents. To improve the API further, the analysis now happens in near real-time. This means that users see what is trending around them at the very moment.
Using the improved Trending API
The Trending API is accessible in the Microsoft Graph via /insights/trending, available in the beta namespace.
You can call the API to get documents trending around you:
Or around someone in your organization:
You can try calling the new API right now with our Graph explorer. Try making a call with the demo tenant or log in with your own user and see what documents are currently trending around you.
Working with the results
A call to the improved Trending API returns a set of trending documents – the top 10 documents by default. The API supports the standard ‘top’ and ‘select’ query options. Each document returned by the API has a weight property with a value that shows to what extent the item is trending around the user. The higher the value, the more relevant the item is to the user. The results are sorted by this value in descending order.
Each returned document contains a resourceVisualization and a resourceReference complex value type (CVT).
The resourceVisualization CVT contains properties such as ‘title’ and ‘previewImageUrl’. We use visualization properties to render the files in our experiences:
The resourceReference CVT contains a ‘webUrl’ that allows you to navigate users to the location of the trending document, in either SharePoint, OneDrive or Outlook attachments.
See our documentation for more information on the Trending API. Let us know what you think in the comments below!
Mário Henriques and Jakub Cech on behalf of the Insights team in Microsoft Graph.