< Back
Get-MgaMailFolder
Post
NAME Get-MgaMailFolder
SYNOPSIS
Get mail folder(s) in Exchange Online
SYNTAX
Get-MgaMailFolder [-IncludeChildFolders] [-Recurse] [-Filter <String>] [-User <String>] [-ResultSize <Int64>]
[-Token <AzureAccessToken>] [<CommonParameters>]
Get-MgaMailFolder [-Name] <FolderParameter[]> [-IncludeChildFolders] [-Recurse] [-Filter <String>] [-User
<String>] [-ResultSize <Int64>] [-Token <AzureAccessToken>] [<CommonParameters>]
DESCRIPTION
Get mail folder(s) with metadata from Exchange Online via Microsoft Graph API
PARAMETERS
-Name <FolderParameter[]>
The name of the folder(S) to query.
Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false
-IncludeChildFolders [<SwitchParameter>]
Output all subfolders on queried folder(s).
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Recurse [<SwitchParameter>]
Iterates through the whole folder structure and query all subfolders.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Filter <String>
The name to filter by.
(Client Side filtering)
Try to avoid, when filtering on single name, use parameter -Name instead of -Filter.
Required? false
Position? named
Default value *
Accept pipeline input? false
Accept wildcard characters? false
-User <String>
The user-account to access. Defaults to the main user connected as.
Can be any primary email name of any user the connected token has access to.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ResultSize <Int64>
The user to execute this under.
Defaults to the user the token belongs to.
Required? false
Position? named
Default value (Get-PSFConfigValue -FullName 'MSGraph.Query.ResultSize' -Fallback 100)
Accept pipeline input? false
Accept wildcard characters? false
-Token <AzureAccessToken>
The token representing an established connection to the Microsoft Graph Api.
Can be created by using New-MgaAccessToken.
Can be omitted if a connection has been registered using the -Register parameter on New-MgaAccessToken.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
MSGraph.Exchange.Mail.Folder
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-MgaMailFolder
Returns all folders in the mailbox of the connected user.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-MgaMailFolder -Name Inbox
Returns the "wellknown" inbox folder in the mailbox of the connected user.
The wellknown folders can be specified by tab completion.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Get-MgaMailFolder -Name Inbox -IncludeChildFolders
Returns inbox and the next level of subfolders in the inbox of the connected user.
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Get-MgaMailFolder -Name Inbox -Recurse
Returns inbox and the all subfolders underneath the inbox of the connected user.
This one is like the "-Recurse" switch on the dir/Get-ChildItem command.
-------------------------- EXAMPLE 5 --------------------------
PS C:\\>Get-MgaMailFolder -Filter "My*" -User "max.master@contoso.onmicrosoft.com" -Token $Token
Retrieves all folders where name starts with My in the mailbox of "max.master@contoso.onmicrosoft.com", using the
connection token stored in $Token.
-------------------------- EXAMPLE 6 --------------------------
PS C:\\>Get-MgaMailFolder -ResultSize 5
Retrieves only the first 5 folders in the mailbox of the connected user.
RELATED LINKS
SYNOPSIS
Get mail folder(s) in Exchange Online
SYNTAX
Get-MgaMailFolder [-IncludeChildFolders] [-Recurse] [-Filter <String>] [-User <String>] [-ResultSize <Int64>]
[-Token <AzureAccessToken>] [<CommonParameters>]
Get-MgaMailFolder [-Name] <FolderParameter[]> [-IncludeChildFolders] [-Recurse] [-Filter <String>] [-User
<String>] [-ResultSize <Int64>] [-Token <AzureAccessToken>] [<CommonParameters>]
DESCRIPTION
Get mail folder(s) with metadata from Exchange Online via Microsoft Graph API
PARAMETERS
-Name <FolderParameter[]>
The name of the folder(S) to query.
Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false
-IncludeChildFolders [<SwitchParameter>]
Output all subfolders on queried folder(s).
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Recurse [<SwitchParameter>]
Iterates through the whole folder structure and query all subfolders.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Filter <String>
The name to filter by.
(Client Side filtering)
Try to avoid, when filtering on single name, use parameter -Name instead of -Filter.
Required? false
Position? named
Default value *
Accept pipeline input? false
Accept wildcard characters? false
-User <String>
The user-account to access. Defaults to the main user connected as.
Can be any primary email name of any user the connected token has access to.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ResultSize <Int64>
The user to execute this under.
Defaults to the user the token belongs to.
Required? false
Position? named
Default value (Get-PSFConfigValue -FullName 'MSGraph.Query.ResultSize' -Fallback 100)
Accept pipeline input? false
Accept wildcard characters? false
-Token <AzureAccessToken>
The token representing an established connection to the Microsoft Graph Api.
Can be created by using New-MgaAccessToken.
Can be omitted if a connection has been registered using the -Register parameter on New-MgaAccessToken.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
MSGraph.Exchange.Mail.Folder
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-MgaMailFolder
Returns all folders in the mailbox of the connected user.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-MgaMailFolder -Name Inbox
Returns the "wellknown" inbox folder in the mailbox of the connected user.
The wellknown folders can be specified by tab completion.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Get-MgaMailFolder -Name Inbox -IncludeChildFolders
Returns inbox and the next level of subfolders in the inbox of the connected user.
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Get-MgaMailFolder -Name Inbox -Recurse
Returns inbox and the all subfolders underneath the inbox of the connected user.
This one is like the "-Recurse" switch on the dir/Get-ChildItem command.
-------------------------- EXAMPLE 5 --------------------------
PS C:\\>Get-MgaMailFolder -Filter "My*" -User "max.master@contoso.onmicrosoft.com" -Token $Token
Retrieves all folders where name starts with My in the mailbox of "max.master@contoso.onmicrosoft.com", using the
connection token stored in $Token.
-------------------------- EXAMPLE 6 --------------------------
PS C:\\>Get-MgaMailFolder -ResultSize 5
Retrieves only the first 5 folders in the mailbox of the connected user.
RELATED LINKS