SOLVED

How to bulk add external recipients to an Office365 Distribution List?

%3CLINGO-SUB%20id%3D%22lingo-sub-1003249%22%20slang%3D%22en-US%22%3EHow%20to%20bulk%20add%20external%20recipients%20to%20an%20Office365%20Distribution%20List%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1003249%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EI'm%20trying%26nbsp%3B%20to%20add%20our%20email%20addresses%20(external%20addresses)%20to%20a%20Distribution%20List%20in%20Office365.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EI've%20followed%20this%20link%26nbsp%3B%20%3CSTRONG%3E%3CA%20href%3D%22https%3A%2F%2Fanswers.microsoft.com%2Fen-us%2Fmsoffice%2Fforum%2Fall%2Fhow-to-bulk-add-external-recipients-to-an%2F765999cf-51ff-4674-a5b9-a4e95d85292b%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fanswers.microsoft.com%2Fen-us%2Fmsoffice%2Fforum%2Fall%2Fhow-to-bulk-add-external-recipients-to-an%2F765999cf-51ff-4674-a5b9-a4e95d85292b%3C%2FA%3E%26nbsp%3B%3C%2FSTRONG%3Eand%20got%20to%20%232%20in%20the%20powershell%20code%20below.%20However%2C%20in%20powershell%20I%20am%20getting%20the%20error%20message%26nbsp%3B%3CSTRONG%3EThe%20'%26lt%3B'%20operator%20is%20reserved%20for%20future%20use%26nbsp%3B%3C%2FSTRONG%3E%2C%20after%20I%20paste%20line%202.%20Any%20ideas%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3COL%3E%3CLI%3E%3CSPAN%3E%24Members%20%3D%20Import-Csv%20D%3A%5CExternalContacts.csv%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%20class%3D%22%22%3E%24Members%20%7C%20ForEach%20%7BAdd-DistributionGroupMember%20-Identity%20%26lt%3B%3C%2FSPAN%3E%3CSPAN%3ETestDL%3C%2FSPAN%3E%3CSPAN%3E%26gt%3B%20-Member%20%24_.DisplayName%7D%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%3EGet-DistributionGroupMember%20-Identity%20%3CTESTDL%3E%3C%2FTESTDL%3E%3C%2FSPAN%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1003249%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Edistribution%20lists%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Eexternal%20contacts%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1004450%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20bulk%20add%20external%20recipients%20to%20an%20Office365%20Distribution%20List%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1004450%22%20slang%3D%22en-US%22%3EYou%20have%20to%20remove%20'%26lt%3B%60%20and%20%60%26gt%3B%60%2C%20for%20example%3A%3CBR%20%2F%3E%24Members%20%7C%20ForEach%20%7BAdd-DistributionGroupMember%20-Identity%20TestDL%20-Member%20%24_.DisplayName%7D%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1006501%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20bulk%20add%20external%20recipients%20to%20an%20Office365%20Distribution%20List%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1006501%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20responding%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F119994%22%20target%3D%22_blank%22%3E%40Ricardo%20Viana%3C%2FA%3E%26nbsp%3B%2C%20I'll%20give%20it%20a%20try.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1020327%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20bulk%20add%20external%20recipients%20to%20an%20Office365%20Distribution%20List%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1020327%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F119994%22%20target%3D%22_blank%22%3E%40Ricardo%20Viana%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20now%20receiving%20the%20below%20message%20for%20Line%202%20.%20Currently%20I%20only%20have%20Data%20in%20the%20ExternalEmailAddress%20and%20Name%20fields%20within%20the%20excel%20sheet.%26nbsp%3B%20Which%20field%20is%20Member%20looking%20for%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECannot%20validate%20argument%20on%20parameter%20'Member'.%20The%20argument%20is%20null.%20Provide%20a%20valid%20value%20for%20the%20argument%2C%20and%20then%20try%20running%20the%20command%20again.%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20InvalidData%3A%20(%3A)%20%5BAdd-DistributionGroupMember%5D%2C%20ParameterBindingValidationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ParameterArgumentValidationError%2CAdd-DistributionGroupMember%3CBR%20%2F%3E%2B%20PSComputerName%20%3A%20outlook.office365.com%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1020395%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20bulk%20add%20external%20recipients%20to%20an%20Office365%20Distribution%20List%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1020395%22%20slang%3D%22en-US%22%3EThat%20cmdlet%20is%20gathering%20the%20data%20from%20Displayname%20column%20from%20the%20CSV%20(-Member%20%24_.DisplayName)%2C%20you%20will%20need%20to%20change%20the%20column%20or%20the%20script.%3CBR%20%2F%3E%3CBR%20%2F%3Eeg%3A.%3CBR%20%2F%3E%24Members%20%7C%20ForEach%20%7BAdd-DistributionGroupMember%20-Identity%20TestDL%20-Member%20%24_.ExternalEmailAddress%7D%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1029042%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20bulk%20add%20external%20recipients%20to%20an%20Office365%20Distribution%20List%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1029042%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F119994%22%20target%3D%22_blank%22%3E%40Ricardo%20Viana%3C%2FA%3E%26nbsp%3B%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMany%20thanks%2C%20this%20worked!%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Hello,

 

I'm trying  to add our email addresses (external addresses) to a Distribution List in Office365.

 

I've followed this link  https://answers.microsoft.com/en-us/msoffice/forum/all/how-to-bulk-add-external-recipients-to-an/765... and got to #2 in the powershell code below. However, in powershell I am getting the error message The '<' operator is reserved for future use , after I paste line 2. Any ideas?

 

  1. $Members = Import-Csv D:\ExternalContacts.csv
  2. $Members | ForEach {Add-DistributionGroupMember -Identity <TestDL> -Member $_.DisplayName}
  3. Get-DistributionGroupMember -Identity <TestDL>

 

5 Replies
Highlighted
You have to remove '<` and `>`, for example:
$Members | ForEach {Add-DistributionGroupMember -Identity TestDL -Member $_.DisplayName}
Highlighted

Thanks for responding @Ricardo Viana , I'll give it a try.

Highlighted

Hi @Ricardo Viana 

I'm now receiving the below message for Line 2 . Currently I only have Data in the ExternalEmailAddress and Name fields within the excel sheet.  Which field is Member looking for

 

Cannot validate argument on parameter 'Member'. The argument is null. Provide a valid value for the argument, and then try running the command again.
+ CategoryInfo : InvalidData: (:) [Add-DistributionGroupMember], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Add-DistributionGroupMember
+ PSComputerName : outlook.office365.com

Highlighted
Best Response confirmed by Kristopherw (New Contributor)
Solution
That cmdlet is gathering the data from Displayname column from the CSV (-Member $_.DisplayName), you will need to change the column or the script.

eg:.
$Members | ForEach {Add-DistributionGroupMember -Identity TestDL -Member $_.ExternalEmailAddress}
Highlighted