How we can get monthly emails sent and received report for a Shared Mailbox in Office 365?

Vinod Survase 4,786 Reputation points
2022-04-18T16:26:45.407+00:00

We are looking for Monthly emails sent and received report for a Shared Mailbox in Office 365. Is there anyway we can get monthly number of emails sent and received for a single shared mailbox in Office 365?

If we can get the report, can we automate the report for previous month?

Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
6,198 questions
Exchange | Exchange Server | Management
Exchange | Hybrid management
0 comments No comments
{count} votes

Accepted answer
  1. KyleXu-MSFT 26,396 Reputation points
    2022-04-19T02:11:18.79+00:00

    @Vinod Survase

    If you want to generate a report automatically, you will need to use a script to do it. For Message Trace, it could only be used to check logs within 10 days (About Historical Search, it isn't suitable used in a script):

    193944-qa-kyle-09-26-08.png

    So, you could use the script below to check logs every 10 days.

    $User = "******@domain.onmicrosoft.com"  
    $PassWord = ConvertTo-SecureString -String "Password" -AsPlainText -Force  
    $UserCredential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $User, $PassWord  
    
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection  
    Import-PSSession $Session -DisableNameChecking    
    
    $Start = (Get-Date).AddDays(-10).ToString('MM/d/yyyy')  
    $End = (Get-Date).AddDays(+1).ToString('MM/d/yyyy')  
    $filename = (Get-Date).ToString('MM-d-yyyy')  
    
    $Receive = (Get-MessageTrace -RecipientAddress ******@domain.onmicrosoft.com -EndDate $End -StartDate $Start).count  
    $Send = (Get-MessageTrace -SenderAddress ******@domain.onmicrosoft.com -EndDate $End -StartDate $Start).count  
    
    $data = "From "+$Start+" to "+$End+" Receive "+$Receive+" Send "+ $Send >> c:\temp\$filename.txt  
    
    Remove-PSSession $Session  
    

    - Make sure you could connect to Exchange online with basic auth.

    • Modify those parameters before running: $User, $PassWord, -RecipientAddress, -SenderAddress, c:\temp

    You could use Windows Task Scheduler to run this script every 10 days.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.