Advanced SharePoint Analytics using Microsoft Power Platform

To fetch the activity logs of a particular SharePoint Online site such as how many users viewed or downloaded a file in the document libraries or visited a page and visualise the data in one place, we can use the Office 365 Management Activity API in Microsoft Power Automate to retrieve the activity logs. We can then use the actions and events from the Office 365 activity logs to create solutions that provide monitoring, analysis, and data visualization.

The Office 365 Management Activity API is a REST web service that relies on Azure AD and the OAuth2 protocol for authentication and authorization. To access the API, we will need to first register an application in Azure AD and configure it with appropriate permissions. This will enable us to request the OAuth2 access tokens it needs to call the API.

The diagram below shows the end to end solution End to End Solution

Prerequisite

Register an Azure AD app with 'ActivityFeed.Read' permission and obtain the app credentials

Workflow

  • Using the obtained application credentials (Client ID and Client Secret), we will use Power Automate to prove its identity when requesting for an access token End to End Solution
  • After receiving the access token, we will use it to make the API call to fetch only the SharePoint audit logs from the previous day End to End Solution
  • Filter out only the required SharePoint site logs from the full SharePoint workload End to End Solution
  • Filter out only the events you want to visualise End to End Solution
  • Store the information into a SharePoint Online list
  • Finally, visualise the data in Power BI from the SharePoint Online list