The script can be used in business rules, custom commands and scheduled tasks to check whether the user on which it is executed has a mailbox in Exchange Online. To use the script in your rule, command or task, add the If PowerShell script returns true condition that runs the script.
PowerShell
$Context.ConditionIsMet = $Context.TargetObject.RecipientType -eq "ADM_EXCHANGERECIPIENTTYPE_MAILBOXENABLED" -and `
$Context.TargetObject.RecipientLocation -eq "ADM_EXCHANGERECIPIENTLOCATION_EXCHANGEONLINE"