How to remove items from Teams mailbox using PowerShell.

Pawel Jarosz 41 Reputation points
2022-03-14T20:45:03.38+00:00

Hi,

Just recently when one person requested email removal, New-ComplianceSearch found some elements not only in user mailboxes but also in one teams mailbox. I tried to run compliancesarch action "Purge" but it did not delete the messages from teams mailbox, waited like 7 days - messages are still there. As this is Teams mailbox - I cannot use Search-Mailbox -DeleteContent for this, so... any idea how to remove such items centrally?

Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,386 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Kael Yao-MSFT 37,676 Reputation points Microsoft Vendor
    2022-03-15T08:45:43.437+00:00

    Hi @Pawel Jarosz

    I tried to run compliancesarch action "Purge" but it did not delete the messages from teams mailbox, waited like 7 days - messages are still there.

    How many items would you like to remove from the Teams mailbox?
    Please note that the New-ComplianceSearchAction cmdlet is not intended for bulk remove messages and would only remove 10 items one time.
    183109-46.png
    If you have many items to remove, you may need to repeat the process in this link:
    Use Security & Compliance Center PowerShell to delete items from the Recoverable Items folder for mailboxes that aren't placed on hold or don't have single item recovery enabled
    183208-47.png


    If it is possible, another workaround would be having the owner of this M365 group manually remove the items in OWA/Outlook.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.