Mail-enabling contacts
The following code sample mail-enables a contact.
[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 contact
$contactDN = "CN=My Contact,CN=Contacts,DC=domain,DC=com"
$contact = $service.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
- Performing Exchange tasks
- Writing ADSI scripts
- Server-side scripting
- IAdmExchangeMailOps
- Online script repository