Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, July 11, 2019 7:59 AM
Hi
I trying to bulk import a CSV file called ExternalContacts.csv with just 4 fields:
ExternalEmailAddress |
Name |
FirstName |
LastName |
And I use the command:
Import-Csv .\ExternalContacts.csv|%{New-MailContact -Name $_.Name -DisplayName $_.Name -ExternalEmailAddress $_.ExternalEmailAddress -FirstName $_.FirstName -LastName $_.LastName}
I then get the errors:
Cannot bind argument to parameter 'Name' because it is an empty string.
+ CategoryInfo : InvalidData: (:) [New-MailContact], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,New-MailContact
+ PSComputerName : outlook.office365.com
Cannot bind argument to parameter 'Name' because it is an empty string.
+ CategoryInfo : InvalidData: (:) [New-MailContact], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,New-MailContact
+ PSComputerName : outlook.office365.com
What the heck am I doing wrong - it's a copy paste from: https://docs.microsoft.com/en-us/office365/securitycompliance/bulk-import-external-contacts
All replies (10)
Thursday, July 11, 2019 5:29 PM âś…Answered
I found the error!
My first CSV file (when I opened it in Notepad) had semicolons as delimiters, once I searched and replaced them with commas, I was fine.
It's such a PAIN to create external contacts via Powershell, I don't understand why MS didn't add an IMPORT button instead..
Thursday, July 11, 2019 5:08 PM
The column names and the script sample seem fine, but the data must be populated for each row in the CSV, otherwise you will still get an error.
Friday, July 12, 2019 9:02 AM
I found the error!
My first CSV file (when I opened it in Notepad) had semicolons as delimiters, once I searched and replaced them with commas, I was fine.
It's such a PAIN to create external contacts via Powershell, I don't understand why MS didn't add an IMPORT button instead..
It is a good idea, hope this feature would be added to the management GUI someday.
Anyway, happy to know issue got resolved.
Regards,
Manu Meng
Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].
Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.
Friday, July 12, 2019 9:17 AM
Thanks Manu. Trimming the CSV file for blank spaces was a pain. Once data was uploaded, updating contact data with powershell was easy.
Monday, July 15, 2019 6:56 AM
Thanks Manu. Trimming the CSV file for blank spaces was a pain. Once data was uploaded, updating contact data with powershell was easy.
I know that, but EMS only recognize the CSV file in a fixed format, and semicolons as delimiters is not included.
I think issue here is more about the Excel, not Exchange server.
Regards,
Manu Meng
Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].
Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.
Monday, July 15, 2019 7:10 AM
Hi Manu
I agree. At first I thought it was a powershell issue. I'm sorry.
Monday, July 15, 2019 7:20 AM
Hi Manu
I agree. At first I thought it was a powershell issue. I'm sorry.
Never mind. You may ask in the Microsoft Office > Excel IT Pro Discussions forum and see if there is a solution.
Regards,
Manu Meng
Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].
Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.
Monday, July 15, 2019 7:41 AM
Oh I did find the solution as stated on my reply from 12th July (semi colons vs. commas). I consider this ticket as completed.
Wednesday, July 17, 2019 8:56 AM
Oh I did find the solution as stated on my reply from 12th July (semi colons vs. commas). I consider this ticket as completed.
OK, it is fine.
Regards,
Manu Meng
Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].
Friday, February 28, 2020 5:17 PM
Hey there. I am having the exact same issue, with the same copy/paste from that same KB. My CSV does not have semicolons, it has commas and is formatted properly, yet I get the same error. Not sure what the issue is.
Have you run into any issues with the script since July of 2019?