Skip to main content

Remove-MSGraphMail

SYNOPSIS

Removes an email from a mailbox using the Microsoft Graph API.

SYNTAX

Remove-MSGraphMail -Mailbox <String> -MessageID <String[]> [-Folder <String>] [-WhatIf] [-Confirm]
[<CommonParameters>]

DESCRIPTION

Deletes an email from a mailbox using the Microsoft Graph API. The mailbox can be specified using a UPN or a mailbox ID. The mailbox can be filtered using a folder ID.

EXAMPLES

PARAMETERS

-Mailbox

Specify the mailbox (or UPN) to remove an email for.

Type: String
Parameter Sets: (All)
Aliases:

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

-MessageID

The ID of the message to remove.

Type: String[]
Parameter Sets: (All)
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: (All)
Aliases: parentFolderId

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

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

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

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
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