E-mail addresses
This code sample retrieves the following parameters of a mail-enabled group:
- Email addresses
- Automatically update e-mail addresses based on e-mail address policy
In the below code sample, the $groupParams variable represents Exchange properties of a mail-enabled group. 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 group
$groupDN = "CN=My Group,CN=Groups,DC=domain,DC=com"
$group = $service.OpenObject("Adaxes://$groupDN", $null, $null, 0)
# Get Exchange properties
$groupParams = $group.GetMailParameters()
# The $groupParams variable represents Exchange properties of a mail-enabled group
# Email addresses
Write-Host "E-Mail Addresses:"
$emailAddresses = $groupParams.EmailAddresses
for ($i = 0; $i -lt $emailAddresses.Count; $i++)
{
$emailAddress = $emailAddresses.GetAddress($i,[ref]"ADS_PROPERTY_NONE")
Write-Host "`t$emailAddress"
}
# Automatically update e-mail addresses based on e-mail address policy
Write-Host "Automatically update e-mail addresses based on e-mail address policy:" `
$groupParams.EmailAddressPolicyEnabled
See also
- Performing Exchange tasks
- Writing ADSI scripts
- Server-side scripting
- IAdmExchangeMailParametersOps
- IAdmExchangeMailParameters
- IAdmExchangeMailGroupParameters
- IAdmExchangeProxyAddressModificationCollection
- Online script repository