Avatar of dgswin
dgswin
Flag for Canada asked on

Exchange Online - delete a message in a mailbox with command powershell

With Exchange Online, with command powershell:
Search-Mailbox -Identity "April Stewart" -SearchQuery 'Subject:"Your bank statement"' -DeleteContent

This message appears:
A parameter cannot be found that matches parameter name 'DeleteContent'

How I can delete a message in a mailbox with a subeject for the mailbox in Exchange Online?
ExchangeMicrosoft 365

Avatar of undefined
Last Comment
dgswin

8/22/2022 - Mon
Vasil Michev (MVP)

You need permissions for that, namely you need to be assigned the "Mailbox Import Export" role.
dgswin

ASKER
Where can i add this role?
Vasil Michev (MVP)

In the Exchange admin center.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
dgswin

ASKER
I don't have this choice, see the attach file
ExchangeAdminRole.jpg
ASKER CERTIFIED SOLUTION
Vasil Michev (MVP)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
dgswin

ASKER
Thank you!