question

VinodSurvase-1595 avatar image
0 Votes"
VinodSurvase-1595 asked VinodSurvase-1595 commented

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

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?

office-exchange-server-administrationoffice-exchange-online-itprooffice-exchange-server-mailflowoffice-exchange-server-connectivityoffice-exchange-hybrid-itpro
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

KyleXu-MSFT avatar image
0 Votes"
KyleXu-MSFT answered VinodSurvase-1595 commented

@VinodSurvase-1595

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 = "admin@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 onlinshared@domain.onmicrosoft.com -EndDate $End -StartDate $Start).count
 $Send = (Get-MessageTrace -SenderAddress onlinshared@domain.onmicrosoft.com -EndDate $End -StartDate $Start).count
    
 $data = "From "+$Start+" to "+$End+" Receive "+$Receive+" Send "+ $Send >> c:\temp\$filename.txt
    
 Remove-PSSession $Session

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.



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks @KyleXu-MSFT , Appreciate your help.

0 Votes 0 ·