I'm using the following code to add an email address to a mailbox (which works). But how can I mark the address as reply address?:
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("[Server]")
# Bind to user object
$userDN = "[DN]"
$user = $admService.OpenObject("Adaxes://$userDN", $NULL, $NULL, 0)
# Create an instance of the AdmExchangeMailContactParameters class
#set EmailAddressPolicyEnabled to False before making changes
$userParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"
$userParams.EmailAddressPolicyEnabled = $False
#$user.SetMailParameters($userParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")
# Add a new modification
$emailAddresses = $userParams.EmailAddresses
$emailAddresses.OverrideOldValues = $False
$newAddress = $emailAddresses.CreateAddress("ADM_EXCHANGE_ADDRTYPE_SMTP", $null)
$newAddress.Address = "[account]"
$emailAddresses.Add("ADS_PROPERTY_APPEND", $newAddress)
$userParams.EmailAddresses = $emailAddresses
$mailbox = $admService.OpenObject("Adaxes://$userDN", $NULL, $NULL, 0)
$mailbox.SetMailParameters($userParams,"ADM_SET_EXCHANGE_PARAMS_FLAGS_RESOLVEVALUEREFERENCES")