Get-EXOMailboxFolderStatistics

This cmdlet is available only in the Exchange Online PowerShell module. For more information, see About the Exchange Online PowerShell module.

Use the Get-EXOMailboxFolderStatistics cmdlet to retrieve information about the folders in a specified mailbox, including the number and size of items in the folder, the folder name and ID, and other information.

For information about the parameter sets in the Syntax section below, see Exchange cmdlet syntax.

Syntax

Get-EXOMailboxFolderStatistics
   [-Archive]
   [-DiagnosticInfo <String>]
   [-ExternalDirectoryObjectId <Guid>]
   [-Folderscope <ElcFolderType>]
   [-Identity <String>]
   [-IncludeAnalysis]
   [-IncludeOldestAndNewestItems]
   [-IncludeSoftDeletedRecipients]
   [-PrimarySmtpAddress <String>]
   [-UserPrincipalName <String>]
   [<CommonParameters>]

Description

A mailbox can have hidden items that are never visible to the user and are only used by applications. The Get-EXOMailboxFolderStatistics cmdlet can return hidden items for the following values: FolderSize, FolderAndSubfolderSize, ItemsInFolder and ItemsInFolderAndSubfolders.

Don't confuse Get-EXOMailboxFolderStatistics cmdlet (folders) with the Get-EXOMailboxStatistics cmdlet (mailboxes).

Examples

Example 1

Get-EXOMailboxFolderStatistics -Identity admin@contoso.com

This example returns statistics for all mailbox folders. Default is FolderScope All.

Example 2

Get-EXOMailboxFolderStatistics -Identity admin@contoso.com -FolderScope Calendar -IncludeOldestAndNewestItems

This example returns statistics only for calendar folders.

Example 3

Get-EXOMailbox -ResultSize Unlimited | Get-EXOMailboxFolderStatistics -FolderScope Inbox | Format-Table Identity,ItemsInFolderAndSubfolders,FolderAndSubfolderSize -AutoSize

This example uses the FolderScope parameter to view Inbox folder statistics for all mailboxes.

Parameters

-Archive

The Archive switch specifies whether to return the usage statistics of the archive mailbox that's associated with the mailbox or mail user. You don't need to specify a value with this switch.

If you use this switch on a mailbox that doesn't have archiving enabled, an error is returned.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-DiagnosticInfo

This parameter is reserved for internal Microsoft use.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-ExternalDirectoryObjectId

The ExternalDirectoryObjectId parameter identifies the mailbox that you want to view by the ObjectId in Microsoft Entra ID.

You can't use this parameter with the Identity, PrimarySmtpAddress, or UserPrincipalName parameters.

Type:Guid
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False
Applies to:Exchange Online

-Folderscope

The FolderScope parameter specifies the scope of the search by folder type. Valid values include:

  • All
  • Archive
  • Calendar
  • Clutter
  • Contacts
  • ConversationHistory
  • DeletedItems
  • Drafts
  • Inbox
  • Journal
  • JunkEmail
  • LegacyArchiveJournals
  • ManagedCustomFolder
  • NonIpmRoot
  • Notes
  • Outbox
  • Personal
  • RecoverableItems
  • RssSubscriptions
  • SentItems
  • SyncIssues
  • Tasks
Type:ElcFolderType
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-Identity

The Identity parameter specifies the identity of the mailbox or mail user. For the best performance, we recommend using the user ID or user principal name (UPN) to identify the mailbox.

Otherwise, you can use any value that uniquely identifies the mailbox or mail user. For example:

  • Name
  • Alias
  • Distinguished name (DN)
  • LegacyExchangeDN
  • SamAccountName

You can't use this parameter with the ExternalDirectoryObjectId, PrimarySmtpAddress, or UserPrincipalName parameters.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False
Applies to:Exchange Online

-IncludeAnalysis

This parameter is reserved for internal Microsoft use.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-IncludeOldestAndNewestItems

The IncludeOldestAndNewestItems switch specifies whether to return the dates of the oldest and newest items in each folder. You don't need to specify a value with this switch.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-IncludeSoftDeletedRecipients

The IncludeSoftDeletedRecipients switch specifies whether to include soft-deleted mailboxes in the results. You don't need to specify a value with this switch.

Soft-deleted mailboxes are mailboxes that have been deleted, but are still recoverable.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-PrimarySmtpAddress

The PrimarySmtpAddress identifies the mailbox that you want to view by primary SMTP email address (for example, navin@contoso.com).

You can't use this parameter with the ExternalDirectoryObjectId, Identity, or UserPrincipalName parameters.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False
Applies to:Exchange Online

-UserPrincipalName

The UserPrincipalName parameter identifies the mailbox that you want to view by UPN (for example, navin@contoso.onmicrosoft.com).

You can't use this parameter with the ExternalDirectoryObjectId, Identity, or PrimarySmtpAddress parameters.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False
Applies to:Exchange Online