We have Exchange online with Office 365. I am trying to set up a dynamic distribution list of external mail contacts if their address contains a certain email domain. I have tried the powershell script below (as well as the WindowsEmailAddress and EmailAddresses attributes instead of External) but can not get it to work. Anyone know how I could accomplish this? With Exchange Online, it has to be done in Powershell.
Set-DynamicDistributionGroup -Identity "Test Group" -RecipientFilter {((RecipientType -eq 'MailContact') -and -(ExternalEmailAddress -like '@example.com'))}
From what I can tell, the email address filter doesn't seem to be working. The domain is definitely correct. Is there an attribute that can check email addresses for Mail Contacts?