Skip to content

Mailbox features

Note

In the below code samples, the $mailboxParams variable represents properties of an Exchange mailbox. To retrieve the properties, use the IAdmExchangeMailParametersOps::GetMailParameters method.

How
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=domain,DC=com"
$user = $admService.OpenObject("Adaxes://$userDN", $NULL, $NULL, 0)

# Get Exchange properties
$mailboxParams = $user.GetMailParameters()

This code sample gets the following properties of the Outlook Web App feature for a mailbox:

  • Enabled
  • Policy
# The $mailboxParams variable represents properties of an Exchange mailbox

# Get properties of the 'Outlook Web App' feature
$owa = $mailboxParams.MailboxFeatures.GetItemByType("ADM_EXCHANGE_MAILBOXFEATURETYPE_OWA")

Write-Host "Outlook Web App:" $owa.Enabled
Write-Host "Outlook Web App policy:" $owa.Policy

This code sample gets the following properties of the Exchange ActiveSync feature for a mailbox:

  • Enabled
  • Policy
# The $mailboxParams variable represents properties of an Exchange mailbox

# Get properties of the 'Exchange ActiveSync' feature
$activeSync = $mailboxParams.MailboxFeatures.GetItemByType(
    "ADM_EXCHANGE_MAILBOXFEATURETYPE_ACTIVESYNC")

Write-Host "Exchange ActiveSync:" $activeSync.Enabled
Write-Host "Exchange ActiveSync policy:" $activeSync.Policy

This code sample gets the following properties of the Unified Messaging feature for a mailbox:

  • Enabled
  • Locked out
  • Dial plan
  • Extension number
  • SIP address
  • E164 address
  • Policy
  • Personal operator extension
  • Additional UM extensions
  • Enable for Automatic Speech Recognition
  • Allow UM calls from non-users
  • Allow users to receive faxes
  • Allow divert calls without caller ID to leave a message
  • Allow users to configure call answering rules
# The $mailboxParams variable represents properties of an Exchange mailbox

# Get properties of the 'Unified Messaging' feature
$unifiedMessaging = $mailboxParams.MailboxFeatures.GetItemByType(
  "ADM_EXCHANGE_MAILBOXFEATURETYPE_UNIFIEDMESSAGING")

# Enabled
Write-Host "Unified Messaging:" $unifiedMessaging.Enabled
if ($unifiedMessaging.Enabled)
{
    # Locked out
    $lockedOut = $unifiedMessaging.LockedOut
    Write-Host "`tUnified Messaging lockout status: " -NoNewline
    switch ($lockedOut)
    {
        "ADM_EXCHANGE_UMLOCKOUTSTATUS_UNKNOWN" 
        {
            Write-Host "Unknown"
        }
        "ADM_EXCHANGE_UMLOCKOUTSTATUS_NOTLOCKEDOUT" 
        {
            Write-Host "The mailbox is not locked out"
        }
        "ADM_EXCHANGE_UMLOCKOUTSTATUS_LOCKEDOUT" 
        {
            Write-Host "The mailbox is locked out."
        }
    }

    # Dial plan
    Write-Host "`tDial plan:" $unifiedMessaging.DialPlan

    # Extension number
    if (-not([System.String]::IsNullOrEmpty($unifiedMessaging.ExtensionNumber)))
    {
        Write-Host "`tExtension number:" $unifiedMessaging.ExtensionNumber
    }

    # SIP address
    if (-not([System.String]::IsNullOrEmpty($unifiedMessaging.SipResourceIdentifier)))
    {
        Write-Host "`tSIP address:" $unifiedMessaging.SipResourceIdentifier
    }

    # E164 address
    if (-not([System.String]::IsNullOrEmpty($unifiedMessaging.E164Address)))
    {
        Write-Host "`tE164 address:" $unifiedMessaging.E164Address
    }

    # Policy
    Write-Host "`tUM mailbox policy:" $unifiedMessaging.Policy

    # Personal operator extension
    Write-Host "`tPersonal operator extension:" $unifiedMessaging.OperatorNumber

    # Additional UM extensions
    $UMExtensions = $unifiedMessaging.Extensions
    Write-Host "`tAdditional Unified Messaging extensions: "
    for ($i = 0; $i -lt $UMExtensions.Count; $i++)
    {
        $UMExtension = $UMExtensions.GetAddress($i,[ref]"ADS_PROPERTY_NONE")
        Write-Host "`t`t$UMExtension"
    }

    # Enable for Automatic Speech Recognition
    Write-Host "`tEnable for Automatic Speech Recognition:" `
        $unifiedMessaging.AutomaticSpeechRecognitionEnabled

    # Allow UM calls from non-users    
    $allowUMCallsFromNonUsers = $unifiedMessaging.AllowUMCallsFromNonUsersFlag
    Write-host "`tAllow UM calls from non-users: " -NoNewline
    switch ($allowUMCallsFromNonUsers)
    {
        "ADM_EXCHANGE_ALLOWUMCALLSFROMNONUSERSFLAG_NONE" 
        {
            Write-host "False"
        }
        "ADM_EXCHANGE_ALLOWUMCALLSFROMNONUSERSFLAG_SEARCHENABLED" 
        {
            Write-host "True"
        }
    }

    # Allow users to receive faxes
    Write-Host "`tAllow users to receive faxes:" `
        $unifiedMessaging.FaxEnabled

    # Allow divert calls without caller ID to leave a message
    Write-Host "`tAllow divert calls without caller ID to leave a message:" `
        $unifiedMessaging.AnonymousCallersCanLeaveMessages

    # Allow users to configure call answering rules
    Write-Host "`tAllow users to configure call answering rules:" `
        $unifiedMessaging.CallAnsweringRulesEnabled
}

This code sample gets the following properties of the POP3 and IMAP features for a mailbox:

  • Enabled
  • MIME format of messages that are retrieved from the server
# The $mailboxParams variable represents properties of an Exchange mailbox

# MIME format of messages that are retrieved from the server
Function GetMIMEFormatOfMessages($protocol)
{
    Write-Host "MIME format of messages that are retrieved from the server: "  -NoNewline

    if ($protocol.UseProtocolDefault)
    {
        Write-Host "Use Protocol Default"
    }
    else
    {
        $messageFormat = $protocol.MessagesRetrievalMimeFormat
        switch ($messageFormat)
        {
            "ADM_EXCHANGE_MESSAGESRETRIEVALTYPE_TEXT" 
            {
                Write-Host "Text"
            }
            "ADM_EXCHANGE_MESSAGESRETRIEVALTYPE_HTML" 
            {
                Write-Host "HTML"
            }
            "ADM_EXCHANGE_MESSAGESRETRIEVALTYPE_HTMLANDALTERNATIVETEXT" 
            {
                Write-Host "HTML and alternative text"
            }
            "ADM_EXCHANGE_MESSAGESRETRIEVALTYPE_ENRICHEDTEXT" 
            {
                Write-Host "Enriched text"
            }
            "ADM_EXCHANGE_MESSAGESRETRIEVALTYPE_ENRICHEDTEXTANDALTERNATIVETEXT" 
            {
                Write-Host "Enriched text and alternative text"
            }
            "ADM_EXCHANGE_MESSAGESRETRIEVALTYPE_BESTBODYFORMAT" 
            {
                Write-Host "Best body format"
            }
            "ADM_EXCHANGE_MESSAGESRETRIEVALTYPE_TNEF" 
            {
                Write-Host "TNEF"
            }
        }
    }
}

# Get properties of the 'POP3' feature
$pop3 = $mailboxParams.MailboxFeatures.GetItemByType("ADM_EXCHANGE_MAILBOXFEATURETYPE_POP3")

# Enabled
Write-Host "POP3:" $pop3.Enabled

# MIME format of messages that are retrieved from the server
GetMIMEFormatOfMessages $pop3

# Get properties of the 'IMAP' feature
$imap = $mailboxParams.MailboxFeatures.GetItemByType("ADM_EXCHANGE_MAILBOXFEATURETYPE_IMAP")

# Enabled
Write-Host "IMAP:" $imap.Enabled

# MIME format of messages that are retrieved from the server
GetMIMEFormatOfMessages $imap

The following code sample determines whether the MAPI feature is enabled for a mailbox.

# The $mailboxParams variable represents properties of an Exchange mailbox

# Get properties of the MAPI feature
$mapi = $mailboxParams.MailboxFeatures.GetItemByType("ADM_EXCHANGE_MAILBOXFEATURETYPE_MAPI")

# Enabled
Write-Host "MAPI:" $mapi.Enabled

This code sample gets the following properties of the Archiving feature for a mailbox:

  • Enabled
  • Archive name
  • Archive quota
  • Archive warning quota
  • Status
# The $mailboxParams variable represents properties of an Exchange mailbox

# Get properties of the 'Archiving' feature
$archiving = $mailboxParams.MailboxFeatures.GetItemByType("ADM_EXCHANGE_MAILBOXFEATURETYPE_ARCHIVE")

# Enabled
Write-Host "Archiving:" $archiving.Enabled
if ($archiving.Enabled)
{
    # Archive name
    Write-Host "`tArchive name:" $archiving.ArchiveName

    # Archive quota
    if ($archiving.ArchiveQuota -ne $NULL)
    {
        $archiveQuota = $archiving.ArchiveQuota.GetGBytes()
        $archiveQuota = [System.Math]::Round($archiveQuota, 4)
        Write-Host "`tQuota value (GB):" $archiveQuota
    }

    # Archive warning quota
    if ($archiving.ArchiveWarningQuota -ne $NULL)
    {
        $issueWarningQuota = $archiving.ArchiveWarningQuota.GetGBytes()
        $issueWarningQuota = [System.Math]::Round($issueWarningQuota, 4)
        Write-Host "`tIssue warning at (GB):" $issueWarningQuota
    }

    # Status
    $archiveStatus = $archiving.State
    Write-Host "`tArchive status: " -NoNewline
    switch ($archiveStatus)
    {
        "ADM_EXCHANGE_ARCHIVEMAILBOX_STATE_NONE"
        {
            Write-Host "None"
        }
        "ADM_EXCHANGE_ARCHIVEMAILBOX_STATE_LOCAL"
        {
            Write-Host "Local archive created"
        }
        "ADM_EXCHANGE_ARCHIVEMAILBOX_STATE_HOSTEDPROVISIONED" 
        {
            Write-Host "Cloud-based archive created"
        }
        "ADM_EXCHANGE_ARCHIVEMAILBOX_STATE_HOSTEDPENDING" 
        {
            Write-Host "Cloud-based archive pending"
        }
        "ADM_EXCHANGE_ARCHIVEMAILBOX_STATE_ONPREMISE" 
        {
            Write-Host "On-premises archive created"
        }
    }
}

This code sample gets the following properties of the Retention Hold feature for a mailbox:

  • Enabled
  • Start date
  • End date
# The $mailboxParams variable represents properties of an Exchange mailbox

# Get properties of the 'Retention Hold' feature
$retentionHold = $mailboxParams.MailboxFeatures.GetItemByType(
    "ADM_EXCHANGE_MAILBOXFEATURETYPE_RETENTIONHOLD")

# Enabled
Write-Host "Retention Hold:" $retentionHold.Enabled
if ($retentionHold.Enabled)
{
    # Start date
    Write-Host "`tStart date:" $retentionHold.StartDate

    # End date
    Write-Host "`tEnd date:" $retentionHold.EndDate
}

This code sample gets the following properties of the Litigation Hold feature for a mailbox:

  • Enabled
  • Start date
  • Put on hold by
  • Note
  • URL
# The $mailboxParams variable represents properties of an Exchange mailbox

# Get properties of the 'Litigation Hold' feature
$litigationHold = $mailboxParams.MailboxFeatures.GetItemByType(
    "ADM_EXCHANGE_MAILBOXFEATURETYPE_LITIGATIONHOLD")

# Enabled
Write-Host "Litigation Hold:" $litigationHold.Enabled
if ($litigationHold.Enabled)
{
    # Start date
    Write-Host "`tStartDate:" $litigationHold.StartDate

    # Put on hold by
    Write-Host "`tPut on hold by:" $litigationHold.Owner

    # Note
    Write-Host "`tNote:" $litigationHold.Comment

    # URL
    Write-Host "`tURL:" $litigationHold.Url
}

See also