Hi @ShunmugaPriya Arunachalam ,
I want to create a dynamic distribution group for a VP which includes VP's direct reports and his direct report's direct reports and so on until the last user has no direct reports.
At present it's not possible to create a dynamic distribution group using direct reports query like this.
Given this, I'd recommend trying to look for another shared attribute like "Department" or anything else which could be used to create a dynamic distribution group that can meet your need. If there's such an attribute in your scenario, you can consider manually creating a Dynamic distribution group for each manager, and then add them into a "root" DL.
Below are the basic steps for your reference:
- Connect to Exchange Online Powershell, run the command below to list VP's direct reports and his direct report's direct reports and so on.
Get-User <user> | select -ExpandProperty directreports
- Create Dynamic Distribution groups for each manager, from the down to top. Below is an example command, you'll need to adapt the example to fit your group name and the manager's distinguished name.
New-DynamicDistributionGroup Manager01Group -RecipientFilter {(Manager -eq 'CN=user1,OU=xxxx.onmicrosoft.com,OU=Microsoft Exchange Hosted Organizations,DC=NAMPR10A005,DC=PROD,DC=OUTLOOK,DC=COM') -and (RecipientType -eq 'UserMailbox')}
- Create a Distribution Group as the root group for VP's group, add the dynamic distribution groups created in step2 into it.
Here‘s another thread discussing the similar question for your reference. Eric shared a thought about using custom attributes as well, but it requires extra effort to deal with these attributes.
https://learn.microsoft.com/en-us/answers/questions/205370/create-dynamic-distribution-group-based-on-manager
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.