Files required can be downloaded from Github: https://github.com/michelderooij/Remove-DuplicateItems
Details on the syntax can be found here: https://eightwone.com/2013/06/21/removing-duplicate-items-from-a-mailbox/
$cred = get-credential; #here I put in your o365 email and password as the credentials
.\Remove-DuplicateItems.ps1 -PublicFolders -Identity <user_email> -Server outlook.office365.com -Credentials $cred -PFStart “\”;
#the above connects to EO, cleans the public folders starting at the root.