Skip to content

Mail-enabling contacts

The following code sample mail-enables a contact.

[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 contact
$contactDN = "CN=My Contact,CN=Users,DC=domain,DC=com"
$contact = $admService.OpenObject("Adaxes://$contactDN", $NULL, $NULL, 0)

# Mail-enable the contact
$alias = "%name%" # Alias
$externalMailAddress = "Jsmith@domain.com" # External e-mail address
$externalMailAddressType = "SMTP" # External e-mail address type

$contact.MailEnable($alias, $externalMailAddress, $externalMailAddressType, $NULL)

See also