hero
Home About

Categories

Archive

May 2024

April 2024

March 2024

February 2024

January 2024

December 2023

November 2023

October 2023

September 2023

August 2023

July 2023

June 2023

May 2023

April 2023

March 2023

February 2023

January 2023

December 2022

back to home

MS Graph API - Use reports to show company email usage statistics

02 July 2023 • 2 mins

Graph API offers a ton of monitoring reports that give system admins insights into their Office 365 tenant. Please find the official documentation here. In today’s article, we will take a look at a report that lists the aggregated Outlook activity per day, for an entire organisation. Here’s the relevant documentation.

Please make sure to read through the basics of using MS Graph API in Peakboard: MS Graph API - Understand the basis and get started

Configuring the data source

The correct URL for the report is:

https://graph.microsoft.com/beta/reports/microsoft.graph.getEmailActivityCounts(period='D30')

We provide an additional parameter, period='D30', to indicate that we only want the data from the last 30 days. For the data source, we use a App-only Graph extension list that doesn’t require any user delegation. Depending on how you configured your AD-registered app, please make sure to have granted the permission for Reports.Read.All there.

image

Getting the data ready

All the data comes as string data types, so it’s hard to to use it in a chart later. We need to add a data flow below the data source, to adjust the columns for later use.

image

We convert the two columns Send and Receive into numbers.

image

And we remove all the useless columns, except for the data and the two numbers we’re interested in. That’s it.

image

Building the chart

A line and area chart is a good choice to display the data. In this case, we use two series. One for the received emails, and one for the sent emails. The x-axis is always the date. The configuration is straightforward, as we already prepared the data very well.

image

Let’s go ahead and have a look at the final result:

image

MS Graph API - Use reports to show company email usage statistics

Newsletter

Want to get notified when a new article is published? Sign up below!