Script repository

Check whether object has mailbox in Exchange Online

Updated on: Jan 18, 2026, Views: 11649

Exchange

The scripts check whether the target object has a mailbox in Exchange Online. The scripts should be executed in the If PowerShell script returns true condition of a business rule, custom command or scheduled task configured for the required object type.

Script 1: Check in Adaxes resources

$Context.ConditionIsMet = $Context.TargetObject.RecipientType -eq "ADM_EXCHANGERECIPIENTTYPE_MAILBOXENABLED" -and `
    $Context.TargetObject.RecipientLocation -eq "ADM_EXCHANGERECIPIENTLOCATION_EXCHANGEONLINE"

Script 2: Check directly in Exchange Online

$Context.ConditionIsMet = $False

try
{
    # Get mail parameters
    $Context.TargetObject.GetMailParameters()
}
catch
{
    # Mailbox does not exist
    return
}

$Context.ConditionIsMet = $True

Comments 0

You must be signed in to comment.

    Got questions?

    Support Questions & Answers

    We use cookies to improve your experience.
    By your continued use of this site you accept such use.
    For more details please see our privacy policy and cookies policy.