다음을 통해 공유


Office 365 distribution list import

Uploading distribution lists can be a pain. Here is a simple way which can assist. Connect to the tenant you wish to upload or create a distribution list. Then create an Excel file with the following columns:

Name
**

Type**

Ensure that the list is added horizontally. For example,

Name Type

Sales Distribution

IT Security

Marketing Distribution

Then run the following script:

Import-CSV “C:\Location of the file>” | foreach {New-DistributionGroup -Name $_.name -Type $_.Type}

Once it is completed, then create another Excel file with the following to add the members:

**
Identity Members**

Sales John

Marketing Sally

IT Brian

Then run the following script:

Import-Csv “C:\Location of the file>” | foreach{Add-DistributionGroupMember -Identity $_.identity -Member $_.members}

Kindly run a test before add-distributiongroupmember -identity or UserprincipalName. Whichever one works, you may use that. As time goes, the script changes.