Forum Discussion
create dynamic distribution group in exchange online office 365
Folks,
I am able to create dynamic security group in azure as below requirements.
- with all users
- user type should be Member
- excludes displayname XYZ
- User should employeeid.
My syntax is below:
(user.objectId -ne null) and (user.userType -eq "Member") and (user.DisplayName -notContains "xyz") and (user.employeeId -ne null).
I know how to create Dynamic Distribution Group in exchange, but i am looking for above criteria how to create specific group as listed above in exchange office 365?
any help thx in advance
3 Replies
Exchange doesn't deal with "users", but with "recipients" - an object with an email address. Thus you cannot cover all users, only those with mailboxes or created as mail-enabled users. In addition, Exchange doesn't expose the employeeID attribute, so you cannot filter on that.
- Orion-SkolBrass Contributor
how are about excluding account contains specific word like Guest = GuestMS@CONTOSO.COM or PreviewGuest@contoso.com?
exclude any reciepient contains words guest?
Guests are actually valid recipients, you can exclude them via the recipienttype. Excluding based on (part of the) name/alias is also possible. This article lists (most of) the properties you can use for creating a filter for Dynamic DG: https://docs.microsoft.com/en-us/powershell/exchange/recipientfilter-properties?redirectedfrom=MSDN&view=exchange-ps