Short Description
Returns mailbox folders.
Syntax
This cmdlet provides 2 parameter sets.
- For getting the first level of folders from the mailbox:
Get-VEXFolder [-Mailbox] <VEXMailbox> [[-Name] <string>] [-Recurse] [<CommonParameters>] |
- For getting subfolders under the specified parent folder from the mailbox:
Get-VEXFolder [-Parent] <VEXFolder> [[-Name] <string>] [-Recurse] [<CommonParameters>] |
Detailed Description
This cmdlet returns folders in the mailbox of the mailbox owner.
Parameters
Parameter | Description | Required | Position | Accept | Accept |
Mailbox | Specifies the mailbox database. The cmdlet will return all mailboxes from this database. | True | 0 | True (ByValue) | False |
Name | Specifies the name of the mailbox. The cmdlet will return the mailbox with this name. | False | 1 | False | True |
Parent | Specifies the parent folder in the mailbox. The cmdlet will return the subfolders of this parent folder. | True | 0 | True (ByValue) | False |
Recurse | Indicates that the cmdlet will return the specified parent folder and all of its subfolders. | False | Named | False | False |
<CommonParameters>
This cmdlet supports Microsoft PowerShell common parameters. For more information about common parameters, see http://go.microsoft.com/fwlink/p/?LinkID=113216.
Example 1
This example shows how to get all folders with subfolders from the mailbox with the name "sales".
You will need to perform the following steps:
- Get the mailbox and save it to the $mailbox variable:
- Run Get-VBOExchangeItemRestoreSession to get the active restore session. Save the result to the $session variable.
- Run Get-VEXDatabase with the $session variable to get the mailbox database. Save the result to the $database variable.
- Run Get-VEXMailbox with the $database variable and Name parameter to get the specific mailbox from the mailbox database. Save the result to the $mailbox variable.
- Run Get-VEXFolder with the $mailbox variable. Use Recurse parameter to get parent folders with subfolders.
PS C:\PS> $session = Get-VBOExchangeItemRestoreSession PS C:\PS> $database = Get-VEXDatabase -Session $session PS C:\PS> $mailbox = Get-VEXMailbox -Database $database -Name "sales" PS C:\PS> Get-VEXFolder -Mailbox $mailbox -Recurse |
Example 2
This example shows how to get the subfolders under the parent folder with the name "Contacts".
You will need to perform the following steps:
- Get the mailbox and save it to the $mailbox variable:
- Run Get-VBOExchangeItemRestoreSession to get the active restore session. Save the result to the $session variable.
- Run Get-VEXDatabase with the $session variable to get the mailbox database. Save the result to the $database variable.
- Run Get-VEXMailbox with the $database variable and Name parameter to get the specific mailbox from the mailbox database.
- Get the parent folder whose subfolders you want to retrieve. Run Get-VEXFolder with the $mailbox variable and Name parameter. Save the result to the $parent variable.
- Get the subfolders of the specified parent folder. Run Get-VEXFolder with the $parent variable.
PS C:\PS> $session = Get-VBOExchangeItemRestoreSession PS C:\PS> $database = Get-VEXDatabase -Session $session PS C:\PS> $mailbox = Get-VEXMailbox -Database $database -Name "Sales" PS C:\PS> $parent = Get-VEXFolder -Mailbox $mailbox -Name "Contacts" PS C:\PS> Get-VEXFolder -Parent $parent |
Related Commands
Get-VBOExchangeItemRestoreSession