Mailbox policies

This code sample outputs the following mailbox policies applied to a mailbox:

  • Sharing policy
  • Role Assignment policy
  • Retention policy
  • Address Book policy

In the below code sample, 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
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

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

# Get Exchange properties
$mailboxParams = $user.GetMailParameters()
# The $mailboxParams variable represents properties of an Exchange mailbox

# Sharing Policy
Write-Host "Sharing Policy:" $mailboxParams.SharingPolicy

# Role Assignment Policy
Write-Host "Role Assignment Policy:" $mailboxParams.RoleAssignmentPolicy

# Retention Policy
Write-Host "Retention Policy:" $mailboxParams.RetentionPolicy

# Address Book Policy
Write-Host "Address Book Policy:" $mailboxParams.AddressBookPolicy

See also