Skip to content

Mailbox policies

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

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

Note

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
$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()
# 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