Applies to: Exchange Server 2013, Exchange Online

Topic Last Modified: 2012-10-01

Use the Get-MailboxFolder cmdlet to retrieve folders for a specified mailbox when the mailbox owner runs the command.

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

Syntax

Get-MailboxFolder [-Identity <MailboxFolderIdParameter>] <COMMON PARAMETERS>
Get-MailboxFolder -GetChildren <SwitchParameter> [-Identity <MailboxFolderIdParameter>] [-MailFolderOnly <SwitchParameter>] [-ResultSize <Unlimited>] <COMMON PARAMETERS>
Get-MailboxFolder -Recurse <SwitchParameter> [-Identity <MailboxFolderIdParameter>] [-MailFolderOnly <SwitchParameter>] [-ResultSize <Unlimited>] <COMMON PARAMETERS>
COMMON PARAMETERS: [-DomainController <Fqdn>]

Examples

EXAMPLE 1

This example retrieves the Inbox folder in Tony's mailbox. The Identity parameter is supplied in the format of <Mailbox Identity>:<Folder>.

Copy Code
Get-MailboxFolder -Identity Tony:\Inbox

EXAMPLE 2

This example returns the root folders in Tony's mailbox. The Identity parameter is supplied in the format of <Mailbox Identity>.

Copy Code
Get-MailboxFolder -Identity Tony 

EXAMPLE 3

This example returns the first level of mail folders in Tony's mailbox.

Copy Code
Get-MailboxFolder -Identity Tony -GetChildren -MailFolderOnly

EXAMPLE 4

This example returns information about all the subfolders under Inbox in Tony's mailbox.

Copy Code
Get-MailboxFolder -Identity Tony:\Inbox -GetChildren

EXAMPLE 5

This example returns all levels of folders under Inbox in Tony's mailbox.

Copy Code
Get-MailboxFolder -Identity Tony:\Inbox -Recurse

Detailed Description

If the mailbox isn't specified, the cmdlet returns the specified folders in the mailbox of the mailbox owner currently running the command. This command checks that the mailbox specified in the Identity parameter is a valid Exchange mailbox before retrieving the requested folders. The cmdlet returns all folders if the MailFolderOnly parameter isn't specified.

You need to be assigned permissions before you can run this cmdlet. Although all parameters for this cmdlet are listed in this topic, you may not have access to some parameters if they're not included in the permissions assigned to you. To see what permissions you need, see the "Mailbox folders" entry in the Recipients Permissions topic.

Parameters

Parameter Required Type Description

GetChildren

Required

System.Management.Automation.SwitchParameter

The GetChildren parameter specifies whether to return only the first level of subfolders under the specified parent folder. You can't specify both this parameter and the Recurse parameter at the same time. The default value is $false.

Recurse

Required

System.Management.Automation.SwitchParameter

The Recurse parameter specifies whether to return the specified parent folder and all of its subfolders. You can't specify both this parameter and the GetChildren parameter at the same time. The default value is $false.

DomainController

Optional

Microsoft.Exchange.Data.Fqdn

The DomainController parameter specifies the fully qualified domain name (FQDN) of the domain controller that retrieves data from Active Directory.

Identity

Optional

Microsoft.Exchange.Configuration.Tasks.MailboxFolderIdParameter

The Identity parameter specifies the mailbox and the folder that the command returns information about. If the folder isn't specified, the command returns information about folders in the root hierarchy of the specified mailbox. You can specify values in the following format: <Mailbox Identity>:<Parent>

Valid values for <Mailbox Identity> include:

  • GUID

  • ADObjectID

  • Distinguished name (DN)

  • Domain\username

  • User principal name (UPN)

  • LegacyExchangeDN

  • SMTP address

  • Alias

  • Store object ID of the parent folder

Values for <Parent> can be both the store object ID and a path string such as \Inbox\Personal.

MailFolderOnly

Optional

System.Management.Automation.SwitchParameter

The MailFolderOnly parameter specifies whether to return only the mail folders in the specified mailbox. The default value is $false.

ResultSize

Optional

Microsoft.Exchange.Data.Unlimited

The ResultSize parameter specifies the maximum number of settings to return. If you want to return all settings that match the command, use unlimited for the value of this parameter.

Input Types

To see the input types that this cmdlet accepts, see Cmdlet Input and Output Types. If the Input Type field for a cmdlet is blank, the cmdlet doesn’t accept input data.

Return Types

To see the return types, which are also known as output types, that this cmdlet accepts, see Cmdlet Input and Output Types. If the Output Type field is blank, the cmdlet doesn’t return data.