Delete folder in Exchange Online from all mailboxes

Copper Contributor

HI,

is there anyone that has a PowerShell script or solution that is able to delete folders out of a user's mailboxes in Exchange-online, as I have searched all over but only found this article with work fantastic https://www.alitajran.com/delete-folder-in-exchange-online-from-all-mailboxes/ in a lab environment that has basic authentication still enabled and has not been disabled yet

 

The problem I'm having is that if the Tenant is only using modern authentication as basic authentication has been disabled by Microsoft due to end of life how can one work around this, at the moment I'm getting the following error (Error: The request failed. The remote server returned an error: (401) Unauthorized. all required permissions are applied,

 

We did enable basic authentication on the client's tenant and this script did work but Microsoft has disabled it again and is now unable to re-enable basic authentication. now I'm stuck in a jam. if there is anyone that is able to update the script to use modern authentication or prove a new solution that will be great.

 

hope someone is able to assist

 

Regards

0 Replies