none
EWS for Conversation History RRS feed

  • Question

  • Good Morning,

    We want to find all folders with the class of IPF.Note.Microsoft.Conversation  (Conversation History folders). We need to parse all mailboxes so we can find any that folks may have renamed. 

    Is there a script out there for powershell to do this?

    Thanks

    Thursday, August 25, 2016 12:54 PM

Answers

  • If your trying to script it you would be better using the Exchange Management Shell eg something like

    $RptCollection = @()
    $Mailboxes = Get-Mailbox -ResultSize Unlimited
    foreach($Mailbox in $Mailboxes){
        Write-host ("processing Mailbox " + $Mailbox.PrimarySMTPAddress)
        $folders = Get-MailboxFolderStatistics -Identity $Mailbox.PrimarySMTPAddress | where-object {$_.ContainerClass -eq "IPF.Note.Microsoft.Conversation"}
        foreach($folder in $folders){
            $rptobj = "" | Select Mailbox,FolderName
    	$rptobj.Mailbox = $Mailbox
            $rptobj.FolderName = $folder.FolderPath
       	$RptCollection += $rptobj
        }
    }
    $RptCollection 

    will be a lot easier then using EWS.

    Cheers
    Glen

    • Marked as answer by mkcj84 Monday, August 29, 2016 12:08 PM
    Friday, August 26, 2016 2:04 AM
  • You need to use ToString if your running it directly in the EMS vs Remote PowerShell try

    $RptCollection = @()
    $Mailboxes = Get-Mailbox -ResultSize Unlimited
    foreach($Mailbox in $Mailboxes){
        Write-host ("processing Mailbox " + $Mailbox.PrimarySMTPAddress.ToString())
        $folders = Get-MailboxFolderStatistics -Identity $Mailbox.PrimarySMTPAddress.ToString() | where-object {$_.ContainerClass -eq "IPF.Note.Microsoft.Conversation"}
        foreach($folder in $folders){
            $rptobj = "" | Select Mailbox,FolderName
    	$rptobj.Mailbox = $Mailbox
            $rptobj.FolderName = $folder.FolderPath
       	$RptCollection += $rptobj
        }
    }
    $RptCollection 

    • Marked as answer by mkcj84 Monday, August 29, 2016 12:08 PM
    Sunday, August 28, 2016 11:19 PM

All replies

  • If your trying to script it you would be better using the Exchange Management Shell eg something like

    $RptCollection = @()
    $Mailboxes = Get-Mailbox -ResultSize Unlimited
    foreach($Mailbox in $Mailboxes){
        Write-host ("processing Mailbox " + $Mailbox.PrimarySMTPAddress)
        $folders = Get-MailboxFolderStatistics -Identity $Mailbox.PrimarySMTPAddress | where-object {$_.ContainerClass -eq "IPF.Note.Microsoft.Conversation"}
        foreach($folder in $folders){
            $rptobj = "" | Select Mailbox,FolderName
    	$rptobj.Mailbox = $Mailbox
            $rptobj.FolderName = $folder.FolderPath
       	$RptCollection += $rptobj
        }
    }
    $RptCollection 

    will be a lot easier then using EWS.

    Cheers
    Glen

    • Marked as answer by mkcj84 Monday, August 29, 2016 12:08 PM
    Friday, August 26, 2016 2:04 AM
  • Thank you very much!

    I am getting the below error when trying to run the script, any ideas?

    Cannot process argument transformation on parameter 'Identity'. Cannot convert the username@domain.com val
    ue of type "Microsoft.Exchange.Data.SmtpAddress" to type "Microsoft.Exchange.Configuration.Tasks.MailboxOrMailUserIdPar
    ameter".
        + CategoryInfo          : InvalidData: (:) [Get-MailboxFolderStatistics], ParameterBindin...mationException
        + FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-MailboxFolderStatistics

    Friday, August 26, 2016 11:42 AM
  • You need to use ToString if your running it directly in the EMS vs Remote PowerShell try

    $RptCollection = @()
    $Mailboxes = Get-Mailbox -ResultSize Unlimited
    foreach($Mailbox in $Mailboxes){
        Write-host ("processing Mailbox " + $Mailbox.PrimarySMTPAddress.ToString())
        $folders = Get-MailboxFolderStatistics -Identity $Mailbox.PrimarySMTPAddress.ToString() | where-object {$_.ContainerClass -eq "IPF.Note.Microsoft.Conversation"}
        foreach($folder in $folders){
            $rptobj = "" | Select Mailbox,FolderName
    	$rptobj.Mailbox = $Mailbox
            $rptobj.FolderName = $folder.FolderPath
       	$RptCollection += $rptobj
        }
    }
    $RptCollection 

    • Marked as answer by mkcj84 Monday, August 29, 2016 12:08 PM
    Sunday, August 28, 2016 11:19 PM
  • Thank you for all of the help. We will continue to try and tweak the script for our needs. I am ending up with no results under FolderName. The mailbox names do list out correctly. 

    I also tried FolderId, Name, and FolderPath but they all end up blank for some reason.

    Mailbox                                                     FolderName
    -------                                                     ----------

    Monday, August 29, 2016 12:11 PM