Microsoft 365 features that help users manage their subscriptions, account settings, and billing information.
Hello EA1979,
Good day!
Thank you for posting to Microsoft Community. We are glad to assist.
Based on your description, you can create the new dynamic distribution list using the New-DynamicDistributionGroup cmdlet in Exchange Online PowerShell. You need to be assigned permissions before you can run this cmdlet.
Under the parameters you can use the RecipientFilter parameter to specify a custom OPATH filter that's based on the value of any available recipient property. You can use any available Windows PowerShell operator, and wildcards and partial matches are supported. This search criteria uses the syntax "Property -ComparisonOperator 'Value'".
- Property is a filterable property and "City" is included. For more filterable properties, see Filterable properties for the RecipientFilter parameter.
Example below. where Property = (Recipienttype , City), -comparisonoperator (-and), value (UserMailbox, Stockholm).
New-DynamicDistributionGroup -Name “SUsers” -OrganizationalUnit “OUorContainerNameToCreateGroupIn” -RecipientContainer “yourdomain.com” -RecipientFilter {RecipientType -eq “UserMailbox” -and City -eq “Stockholm”}.
Reference: New-DynamicDistributionGroup (ExchangePowerShell) | Microsoft Learn
Please let me know if you have any further queries.
Looking forward to your response.
Best Regards,
Ashraf | Microsoft Community Moderator.