Remove-Email Cmdlet
Deletes IMAP data.
Syntax
Remove-Email [parameters]
Remarks
The Remove-Email cmdlet allows you to use a syntax similar to SQL DELETE statements to delete IMAP data.
$conn = Connect-Email -Port 993 -Server 'outlook.office365.com' -Password 'password' -User 'user' -Protocol 'IMAP' -SMTPPort 587 SMTP Server 'smtp.office365.com' Remove-Email -Connection $conn -Table "[INBOX]" -Id "1"The Where parameter can also be used to specify the primary key:
Remove-Email -Connection $conn -Table "exTablePowershell;" -Where "Id = 1"The primary key can also be passed to the cmdlet along the pipeline:
Select-Email -Connection $conn -Table [INBOX] -Where "Subject = 'Test'" | Remove-Email