Edit

Share via


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

Default (Default)

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

Applicable: Exchange Online

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.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DiagnosticInfo

Applicable: Exchange Online

This parameter is reserved for internal Microsoft use.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ExternalDirectoryObjectId

Applicable: Exchange Online

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.

Parameter properties

Type:Guid
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Folderscope

Applicable: Exchange Online

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

Parameter properties

Type:ElcFolderType
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Identity

Applicable: Exchange Online

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-IncludeAnalysis

Applicable: Exchange Online

This parameter is reserved for internal Microsoft use.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IncludeOldestAndNewestItems

Applicable: Exchange Online

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.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IncludeSoftDeletedRecipients

Applicable: Exchange Online

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.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PrimarySmtpAddress

Applicable: Exchange Online

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-UserPrincipalName

Applicable: Exchange Online

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.