Graph API Mail Flow reporting

Daniel Birrell 41 Reputation points
2024-03-20T15:49:33.44+00:00

Hi,

I am currently querying various API's so that I can automate the extracting of data to Azure storage.

I have thus far been able to pull sentinel data, attack simulator data, vulnerability data etc via the respective API's.

I am looking now to query Mail Trace data and in particular I am looking for a breakdown of mail flow for a 30 day period. All I need is a count of how many emails were delivered, rejected, spammed etc.

The documentation on the various possibilities here is all over the place. Has anyone been able to query such data and if so what's the current recommended API for this? The reporting web service seems to be deprecated for the most part.

I have been able to successfully query https://graph.microsoft.com/v1.0/reports/getEmailActivityCounts(period='D7') as per https://learn.microsoft.com/en-us/graph/api/reportroot-getemailactivitycounts?view=graph-rest-1.0&tabs=http but this does not give me any useful data. Any help here from the community would be appreciated :)

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,526 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,166 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 95,071 Reputation points MVP
    2024-03-20T18:01:46.8233333+00:00

    The reporting web service and/or PowerShell are your options here. Nothing regarding mail flow is exposed within the Graph API, either under the reporting endpoints or otherwise. Get-MessageTrace should get you started and also these:

    Get-Command Get-Mail*Report
    
    Get-MailboxActivityReport
    Get-MailboxUsageDetailReport
    Get-MailboxUsageReport
    Get-MailDetailATPReport
    Get-MailDetailDlpPolicyReport
    Get-MailDetailEncryptionReport
    Get-MailDetailEvaluationModeReport
    Get-MailDetailTransportRuleReport
    Get-MailFilterListReport
    Get-MailFlowStatusReport
    Get-MailTrafficATPReport
    Get-MailTrafficEncryptionReport
    Get-MailTrafficPolicyReport
    Get-MailTrafficSummaryReport
    

0 additional answers

Sort by: Most helpful