Forum Discussion
Create Dynamic Distribution List in EXO using Recipient Filters
Hello - I'm brand new to EXO Dynamic Distribution Lists; trying to create a simple (I think) Dynamic Distribution List in that's based on the recipient's SMTP domain, so something like:
New-DynamicDistributionGroup -Name "TESTDDG3" -RecipientFilter "(RecipientType -eq 'MailUser') -and (PrimarySMTPAddress -like 'mydomain.com')"
The syntax is accepted, and the group is created... but doesn't populate with the appropriate MailUsers. Can anyone help with the syntax?
- Afaik PrimarySMTPAddress is not supported for recipient filters. You can use UserPrincipalName instead, which in most cases should match the PrimarySMTPAddress anyway. Another option is to use the Emailaddresses, though you cannot specifically match the primary one with it.
Also, when creating the filter, make sure to add an asterisk and the @ sign:
Get-Recipient -RecipientPreviewFilter {(RecipientType -eq 'MailUser') -and (Emailaddresses -like '*@contoso.com')}
2 Replies
- Afaik PrimarySMTPAddress is not supported for recipient filters. You can use UserPrincipalName instead, which in most cases should match the PrimarySMTPAddress anyway. Another option is to use the Emailaddresses, though you cannot specifically match the primary one with it.
Also, when creating the filter, make sure to add an asterisk and the @ sign:
Get-Recipient -RecipientPreviewFilter {(RecipientType -eq 'MailUser') -and (Emailaddresses -like '*@contoso.com')}- MAVariCopper Contributor
VasilMichev While this works to get recipients client-side, this unfortunately does not work when you try to use the filter in New-DynamicDistributionGroup or Set-DynamicDistributionGroup cmdlets with the -RecipientFilter flag as it does not allow wildcards in the beginning of a filter value and will explicitly throw an error that tells you so.
"Set-DynamicDistributionGroup: | Microsoft. Exchange. Management. Tasks. RecipientTaskException | Wildcards cannot be used as the first character. Please revise the filter criteria."