question

RustemovChingis-7073 avatar image
0 Votes"
RustemovChingis-7073 asked joyceshen-MSFT commented

Limitation on number of emails to be deleted via New-ComplianceSearchAction

Hello

Is there any limitation on number of emails which can be deleted by New-ComplianceSearchAction?What I have noticed with SoftDelete is that it can work only on 10 e,ails, and if the number exceeds it the code do nothing. I use this command: New-ComplianceSearchAction -SearchName "all" -Purge -PurgeType SoftDelete

P.S. The same with HardDelete.

Is there a way to delete a bulk of emails of a user with PowerShell in Exchange Online?

office-exchange-server-administrationoffice-exchange-online-itpro
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,

I am writing to see how everything is going on with this thread. If you still have further concern on this, please feel free to let us know.


If an Answer is helpful, please click "Accept Answer" and upvote it.

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.


0 Votes 0 ·
michev avatar image
0 Votes"
michev answered

You've already found the limitation, there's no way around it. If you need to delete more than 10 items, run additional instances of New-ComplianceSearchAction. Or use the good old Search-Mailbox cmdlet.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

joyceshen-MSFT avatar image
0 Votes"
joyceshen-MSFT answered joyceshen-MSFT commented

Hi @RustemovChingis-7073

Yes, considering that the recoverable items folder play an essitial role in preserving data for mailboxes on hold, normally it's recommended to use the New-ComplianceSearchAction cmdlet which has a limit of 10 items at one time to lower the potential impact of mistakes.

If you insist on deleting more than 10 items at a time, you can use the Search-Mailbox cmdlet instead. The example below searchs and deletes the items received in the last three months from user1's recoverable items folder:

  Search-Mailbox -Identity user1 -SearchDumpsterOnly -SearchQuery {Received:"2020/5/22..2020/8/24"} -EstimateResultOnly
  Search-Mailbox -Identity user1 -SearchDumpsterOnly -SearchQuery {Received:"2020/5/22..2020/8/24"} -DeleteContent

202524-image.png

And here is a script to purge messages from Exchange Online using an Office 365 content search and a purge action applied to the results of that search.

For more related information:
How to Run Microsoft 365 Content Searches to Purge Exchange Online Messages
Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.

Is there a way to delete more than 10 items at a time from the RecoverableItems folder?


If an Answer is helpful, please click "Accept Answer" and upvote it.

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.



image.png (35.5 KiB)
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello

Thank you!

![202580-image.png][1]

But -DeleteContent part is not working (pls see the screenshot)

My account has Discovery Management rights
[1]: /answers/storage/attachments/202580-image.png

0 Votes 0 ·
image.png (37.3 KiB)
joyceshen-MSFT avatar image joyceshen-MSFT RustemovChingis-7073 ·

Hi,

Could you please try adding your account to the role group in EAC? Make sure the group contains the role Mailbox Search and Mailbox Import Export.

Manage role groups in Exchange Online

Then come out of powershell and go back in again to check the result again


0 Votes 0 ·

Thank you

I have encountered this error when tried add separately and in Organization Management too
202628-image.png


0 Votes 0 ·
image.png (54.3 KiB)
Show more comments