Getting Outlook folder item count Office365

Welcome Forums General PowerShell Q&A Getting Outlook folder item count Office365

Viewing 2 reply threads
  • Author
    Posts
    • #11008
      Participant
      Topics: 7
      Replies: 5
      Points: 64
      Rank: Member

      Hi,

      Looking for a way to get a count of individual Outlook folder items (emails)

      We are migrating from on-premise Exchange 2010 to Office365, looking for a way to get a count of emails in each folder/subfolder on each side so we can verify that the migration moved all the emails.

      I am sure there must be some way to do this in Powershell.

    • #11018
      Keymaster
      Topics: 18
      Replies: 4872
      Points: 1,903
      Helping HandTeam Member
      Rank: Community Hero

      The PowerShell components of Exchange – either on-premises or hosted – aren’t amazing at “cracking open” a mailbox to get at its contents. Do you have a way of doing this against your local Exchange server by using PowerShell?

    • #11029
      Participant
      Topics: 7
      Replies: 5
      Points: 64
      Rank: Member

      Hi Don, Thanks for responding.

      I was able to find this script which works on a on premises Exchange, have not had a chance to test it against Office365 yet since I am fighting a number of “fires” today (I believe this is from Shay Levy):

      function Get-MailboxFolder($folder)
      {
      “{0}: {1}” -f $folder.name, $folder.items.count

      foreach ($f in $folder.folders)
      {
      Get-MailboxFolder $f
      }
      }

      $ol = new-object -com Outlook.Application
      $ns = $ol.GetNamespace(“MAPI”)
      $mailbox = $ns.stores | where {$_.ExchangeStoreType -eq 0}
      $mailbox.GetRootFolder().folders | foreach { Get-MailboxFolder $_}

Viewing 2 reply threads
  • The topic ‘Getting Outlook folder item count Office365’ is closed to new replies.