Skip to main content

Get-MSGraphMail

SYNOPSIS

Retrieves emails from a mailbox using the Microsoft Graph API.

SYNTAX

Single

Get-MSGraphMail -Mailbox <String> -MessageID <String[]> [-Folder <String>] [-MIME] [-Select <String[]>]
[-Pipeline] [<CommonParameters>]

Multi

Get-MSGraphMail -Mailbox <String> [-Folder <String>] [-HeadersOnly] [-Search <String>] [-Select <String[]>]
[-PageSize <Int32>] [-Pipeline] [-Summary] [<CommonParameters>]

DESCRIPTION

Gets emails from a mailbox using the Microsoft Graph API. The mailbox can be specified using a UPN or a mailbox ID. The mailbox can be searched using a string. The mailbox can be filtered using a folder ID. Messages can be returned as a PowerShell object or MIME message. A formatted summary of the messages can be returned.

EXAMPLES

PARAMETERS

-Mailbox

Specify the mailbox (or UPN) to retrieve emails for.

Type: String
Parameter Sets: Single
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Type: String
Parameter Sets: Multi
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-MessageID

Retrieve a single message using a message ID.

Type: String[]
Parameter Sets: Single
Aliases: id

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Folder

Retrieve from folder.

Type: String
Parameter Sets: Single
Aliases: parentFolderId

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Type: String
Parameter Sets: Multi
Aliases: parentFolderId

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-HeadersOnly

Retrieve headers only.

Type: SwitchParameter
Parameter Sets: Multi
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-MIME

Retrieve the message in MIME format.

Type: SwitchParameter
Parameter Sets: Single
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

Search for emails based on a string.

Type: String
Parameter Sets: Multi
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Select

Selects the specified properties.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-PageSize

Return this number of results.

Type: Int32
Parameter Sets: Multi
Aliases:

Required: False
Position: Named
Default value: 500
Accept pipeline input: False
Accept wildcard characters: False

-Pipeline

Transform the output into an object suitable for piping to other commands.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Summary

Transform the output into a summary format.

Type: SwitchParameter
Parameter Sets: Multi
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

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

INPUTS

OUTPUTS

A powershell object containing the response.

NOTES