This is useful when verifying if your PST import was successfully uploaded to Exchange or Office 365.
To count total # of items in Outlook https://answers.microsoft.com/en-us/msoffice/forum/all/show-total-number-of-items-make-it-so-for-all/f0826c4d-461e-49ae-be89-aeaac7d130dd
For counting the total numbers of all items in all folders, please apply below VBA code in Outlook.
1. Press Alt + F11 keys simultaneously to open the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and then paste below VBA code into the new opening Module window.
VBA: Count/show total numbers of items/emails in all folders in Outlook
3. Press the F5 key or click the Run button to run this VBA. And now the total number of items/emails in each folder is showing beside the folder name.
Sub ShowTotalInAllFolders() Dim oStore As Outlook.Store Dim oRoot As Outlook.Folder On Error Resume Next For Each oStore In Application.Session.Stores Set oRoot = oStore.GetRootFolder ShowTotalInFolders oRoot Next End Sub Private Sub ShowTotalInFolders(ByVal Root As Outlook.Folder) Dim oFolder As Outlook.Folder On Error Resume Next If Root.Folders.Count > 0 Then For Each oFolder In Root.Folders oFolder.ShowItemCount = olShowTotalItemCount ShowTotalInFolders oFolder Next End If End Sub
This will undo the total count and put it back to the unread count
Sub ShowTotalInAllFolders() Dim oStore As Outlook.Store Dim oRoot As Outlook.Folder On Error Resume Next For Each oStore In Application.Session.Stores Set oRoot = oStore.GetRootFolder ShowTotalInFolders oRoot Next End Sub Private Sub ShowTotalInFolders(ByVal Root As Outlook.Folder) Dim oFolder As Outlook.Folder On Error Resume Next If Root.Folders.Count > 0 Then For Each oFolder In Root.Folders oFolder.ShowItemCount = olShowUnreadItemCount ShowTotalInFolders oFolder Next End If End Sub
Get folder content counts from Office 365
Allow scripts downloaded from Internet
Set-ExecutionPolicy RemoteSigned
Enter your admin account and password
$UserCredential = Get-Credential
Connect to Office 365 Exchange shell
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Run this… dunno why
Import-PSSession $Session -DisableNameChecking
Get the statistics for a specific user which will include folder name and total # of items in each folder
Get-MailboxFolderStatistics desired.username | Select Name,ItemsinFolder
Disconnect before closing the powershell window
Remove-PSSession $Session