Statistics Folder Mailbox

Hi

I need a list of emails located on a Mailbox folder, but am unable to export that data.
You help me?

[PS] C:\>Get-MailboxFolderStatistics -Identity user -FolderScope Inbox | ?{$_.FolderPath -like '/Folder'} | Select Name, ItemsInFolder | Select Timestamp, Sender, {$_.Recipients}, MessageSubject

Regards

February 17th, 2015 3:24pm

Hi Thor,

in your case its combination of get-mailboxfolderstatistic and get-messagetrackinglog.Not sure if you can combine those (brighter minds than me probably can )

THis command will list all e-mails and export to csv:

Get-MessageTrackingLog -start "11/3/2014 14:00:00" -end "11/4/2015 12:00:00" -recipient user@
domain.com  | select-object timestamp,sender,messagesubject |export-csv c:\temp\user.csv

hope this help

Free Windows Admin Tool Kit Click here and download it now
February 17th, 2015 3:59pm

the problem is that I have so many logs must attack the mailbox anf determinate folder
February 17th, 2015 4:29pm

Hi,

There are no output of Timestamp, Sender, {$_.Recipients}, MessageSubject under Get-MailboxFolderStatistics cmdlet. They are the output of Get-MessageTrackingLog cmdlet. We should create a script to combine these two cmdlet to satisfy your requirement. It may take some time.

Here are the outputs of Get-MailboxFolderStatistics cmdlet.

RunspaceId;Date;Name;FolderPath;FolderId;FolderType;ItemsInFolder;DeletedItemsInFolder;FolderSize;ItemsInFolderAndSubfolders;DeletedItemsInFolderAndSubfolders;FolderAndSubfolderSize;OldestItemReceivedDate;NewestItemReceivedDate;OldestDeletedItemReceivedDate;NewestDeletedItemReceivedDate;OldestItemLastModifiedDate;NewestItemLastModifiedDate;OldestDeletedItemLastModifiedDate;NewestDeletedItemLastModifiedDate;ManagedFolder;TopSubject;TopSubjectSize;TopSubjectCount;TopSubjectClass;TopSubjectPath;TopSubjectReceivedTime;TopSubjectFrom;TopClientInfoForSubject;TopClientInfoCountForSubject;SearchFolders

Best Regards.

Free Windows Admin Tool Kit Click here and download it now
February 18th, 2015 4:36am

Hi,

Just wanted to confirm if you have resolved your concern ?

If no, you can check this automated application too (http://www.exchangereports.net/) that helps to get the list of emails located on a Mailbox folder at granular level and exported them into desired format.

February 19th, 2015 12:39am

You can use Exchange Web Services to get the data from the actual mailbox. There's one important piece of configuration needed, and that is the role assignment for impersonation. This can be easily created with:

New-ManagementRoleAssignment -User <Administrator> -Role ApplicationImpersonation

Then the code below can be used. You'll have to replace <AdministratorEmailAddress> with the email address belonging to the admin that has been granted the impersonation role. <TargetEmailAddress> is the mailbox for which you want to obtain the statistics. The folder name was specified as 'Inbox' but this can be changed as well in the $seachFilter, right near the end. Also, the number of messages retrieved is set for 100, but this can be easily changed in the 3rd line from the bottom.

Add-Type -Path "C:\Program Files\Microsoft\Exchange\Web Services\1.2\Microsoft.Exchange.WebServices.dll"
$service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010_SP1)
$service.UseDefaultCredentials=$true
$service.AutodiscoverUrl("<AdministratorEmailAddress>",{$true})
$service.ImpersonatedUserId = New-Object Microsoft.Exchange.WebServices.Data.ImpersonatedUserId([Microsoft.Exchange.WebServices.Data.ConnectingIdType]::SmtpAddress, "<TargetEmailAddress>")
$MailboxRoot = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service, [Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::MsgFolderRoot)
$View = New-Object  Microsoft.Exchange.WebServices.Data.FolderView(2)
$View.PropertySet = [Microsoft.Exchange.WebServices.Data.BasePropertySet]::IdOnly
$SearchFilter = New-Object Microsoft.Exchange.WebServices.Data.SearchFilter+IsEqualTo([Microsoft.Exchange.WebServices.Data.FolderSchema]::DisplayName, 'Inbox')
$folder=[Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$MailboxRoot.FindFolders($SearchFilter, $View).Id)
$psPropset = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
$messages=$folder.FindItems(100)
[void]$service.LoadPropertiesForItems($messages,$psPropset)
$messages.Items | Select-Object DateTimeReceived, Sender, ToRecipients, ConversationTopic

The code was derived from this blog post.

Free Windows Admin Tool Kit Click here and download it now
February 19th, 2015 2:11am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics