Fix Exchange Online PowerShell New-MailContact Bulk Import for Contact CSVs
Question details
The user needs to bulk import Exchange Online mail contacts from a CSV with additional fields such as MobilePhone, Department, Company, and address fields.

- Product
- Microsoft Exchange Online PowerShell / New-MailContact
- Device & OS
- not provided
- Scenario
- The user is importing a CSV of mail contacts into Exchange Online with PowerShell and wants to include additional contact information beyond the basic name and email fields.
- Observed behavior
- The basic New-MailContact command succeeds, but the import fails when additional CSV columns such as MobilePhone, Department, Company, and address fields are added.
Before running the script, connect to Exchange Online PowerShell and open the CSV file to verify that every header exactly matches a New-MailContact parameter, for example, use MobilePhone instead of Phone. This prevents parameter-binding errors when extra columns are added.
Map Every CSV Header to the Correct New-MailContact Parameter
Use this solution when the basic import works but additional fields fail; it fixes the command by using the exact Exchange Online parameter names for each CSV column.
The failure usually occurs because Exchange Online PowerShell binds CSV columns by header name. If a header is named MobilePhone but the script uses -Phone, or if the address headers do not match Exchange parameter names, the command stops or skips values.
Open Windows PowerShell as administrator and run Connect-ExchangeOnline, then sign in with your Microsoft 365 admin account.
Run Import-Csv "C:\Contacts\contacts.csv" | Get-Member -MemberType NoteProperty to list the exact column names in the CSV.
Use Import-Csv and ForEach-Object with New-MailContact, mapping fields such as -MobilePhone $_.MobilePhone, -Department $_.Department, -Company $_.Company, -StreetAddress $_.StreetAddress, -City $_.City, -StateOrProvince $_.StateOrProvince, -PostalCode $_.PostalCode, and -CountryOrRegion $_.CountryOrRegion.
Run Get-MailContact -Identity "Display Name" | Format-List Name,DisplayName,ExternalEmailAddress,MobilePhone,Department,Company,City,StateOrProvince,PostalCode to confirm all extended fields imported.

Rename CSV Headers to Match Exchange Online Parameter Names
Use this when the CSV already exists but its headers do not use the exact names required by New-MailContact.
Use a Hashtable to Pass Only Present Contact Fields
Use this when the CSV contains optional or empty columns and you want a script that avoids binding errors for blank values.
Use WPS Office Spreadsheets to Clean and Prepare Exchange Contact CSV Files
WPS Office is a free, lightweight Microsoft Office alternative that opens, edits, and saves Excel-compatible CSV contact lists. It helps you standardize headers before running Exchange Online PowerShell while preserving .xlsx and .csv compatibility, a familiar ribbon interface, and seamless migration from Microsoft 365.
- 1. Download WPS Office Free: Go to the WPS Office download page and install WPS Office for Windows, macOS, Linux, Android, or iOS.
- 2. Open the contact CSV in WPS Office Spreadsheets: Launch WPS Office, click Menu > Open, and select the CSV file that you use for Exchange Online mail contacts.
- 3. Edit and save the header row: Rename headers such as Phone to MobilePhone and Zip to PostalCode, then click Menu > Save As > CSV UTF-8 before importing the file in Exchange Online PowerShell.

Frequently Asked Questions
Why does my New-MailContact command fail only when I add MobilePhone, Department, Company, or address fields?
The CSV header likely does not match the Exchange parameter being bound. Use -MobilePhone $_.MobilePhone instead of -Phone, and rename address columns to StreetAddress, City, StateOrProvince, PostalCode, and CountryOrRegion.
How do I connect to Exchange Online PowerShell before running Import-Csv?
Open Windows PowerShell as administrator, run Connect-ExchangeOnline, and sign in with a Microsoft 365 administrator account. Then verify the CSV path and headers before running Import-Csv.
Can I prepare the CSV headers in WPS Office instead of Excel?
Yes. Open the CSV in WPS Office Spreadsheets, edit the header row to match Exchange Online parameter names, and save as CSV UTF-8 before importing.
What are the correct address parameter names for New-MailContact?
Use StreetAddress, City, StateOrProvince, PostalCode, and CountryOrRegion. Avoid generic headers like Address, State, Zip, or Country unless you explicitly map them in the script.
Do empty optional fields in CSV cause New-MailContact to fail?
They can if the script passes empty or null values incorrectly. Use a hashtable that only adds MobilePhone, Department, Company, and address parameters when the CSV column has a value.




