help need to create Dynamic Distribution group in exchange online office 365



 I have created Dynamic security group with this parameters query:

(user.objectId -ne null) and (user.userType -eq "Member") and (user.DisplayName -notContains "Archive") and (user.employeeId -ne null)


like to replicate with Dynamic Distribution group.

User must have mailbox

user must have employeeID

Specific Office  (there is office properties in recipients).


this is so far what i have

New-DynamicDistributionGroup "DDG_AllEmployees" -RecipientFilter {((RecipientType -eq 'UserMailbox') -and -not (UserAccountControl -eq "AccountDisabled, NormalAccount"))}


Any help, thanks in advance

3 Replies

There's no "employeeId" attribute for Exchange Online to leverage, so you cannot use that. You can however populate one of the customattributeXX and use it instead.

customattributeXX any link how to create

There's nothing to "create", the attributes are already present in Exchange Online. All you need to do is populate their values as needed, for example:


Set-Mailbox vasil -CustomAttribute12 blabla