Dynamic Distribution Lists (DDL) in Microsoft 365 are groups that automatically include users based on filters and conditions. However, you cannot directly export members of a DDL as you would with a regular distribution list. Instead, you can use PowerShell to achieve this by first connecting to Exchange Online and then executing a script to retrieve and export the members based on the filter rules.
Here's a step-by-step guide to exporting all users of a Dynamic Distribution List in Microsoft 365:
Install-Module -Name ExchangeOnlineManagementConnect-ExchangeOnlineEnter your Microsoft 365 admin credentials when prompted.
Replace <DDL_Name_or_Email> with the name or email address of the DDL you want to export:
$DDL = Get-DynamicDistributionGroup -Identity "<DDL_Name_or_Email>"Replace <Export_Path> with the path where you want to save the CSV file:
$Members | Select-Object DisplayName, PrimarySmtpAddress | Export-Csv -Path "<Export_Path>" -NoTypeInformationThis will create a CSV file containing the display name and primary email address of all the users included in the DDL.
That's it! You should now have a CSV file containing all the users of the Dynamic Distribution List in Microsoft 365.