Contact Problems

Import Exchange Online Contacts and Hide Them from the GAL

Elise WilliamsElise Williams Nov 14, 2026 868 views

Question details

Import external contacts from a CSV file into Exchange Online and hide them from the Global Address List.

Product
Exchange Online
Device & OS
not provided
Scenario
An administrator needs to bulk-create external mail contacts without displaying them in address lists.
Observed behavior
New-MailContact does not recognize the parameter used to hide contacts from address lists.
Before you start

Prepare a CSV with Name, ExternalEmailAddress, FirstName, and LastName columns, and check that the email addresses uniquely identify the contacts. Use an account with permission to create and modify mail contacts, and connect to Exchange Online PowerShell.

Solution 1Recommended

Create the contacts, then hide them with Set-MailContact

Use separate Exchange Online PowerShell commands because the visibility setting cannot be applied with New-MailContact.

1
Connect to Exchange Online

Open PowerShell, install the ExchangeOnlineManagement module if needed with Install-Module ExchangeOnlineManagement, and run Connect-ExchangeOnline. Sign in with an authorized administrator account.

2
Import and create the contacts

Replace the path below with your CSV file path and run: $contacts = Import-Csv "C:\path\contacts.csv" foreach ($contact in $contacts) { try { New-MailContact -Name $contact.Name -DisplayName $contact.Name -ExternalEmailAddress $contact.ExternalEmailAddress -FirstName $contact.FirstName -LastName $contact.LastName -ErrorAction Stop Set-MailContact -Identity $contact.ExternalEmailAddress -HiddenFromAddressListsEnabled $true -ErrorAction Stop } catch { Write-Warning "Could not create or hide $($contact.ExternalEmailAddress): $_" } }

3
Verify the visibility setting

Run Get-MailContact -Identity "contact@example.com" | Format-List DisplayName,ExternalEmailAddress,HiddenFromAddressListsEnabled for a created contact. Confirm that HiddenFromAddressListsEnabled is True, and repeat for other contacts as needed.

Check any warnings: If creation succeeds but the hide command fails, the contact may remain visible. Correct the reported error and rerun Set-MailContact for that contact. Address list updates may take time to appear.
Free Microsoft Office alternative

Prepare your contact CSV with WPS Office

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface for preparing contact data. Its Microsoft Office format compatibility makes it easy to move existing files into WPS; Exchange Online PowerShell is still required to import and hide contacts.

Review and edit contact names and email addresses in a spreadsheetOpen and edit Microsoft Excel XLSX filesWork with CSV files for contact importsUse a familiar interface for an easy transition from Microsoft Office
QA img-9

Frequently Asked Questions

Why doesn't HiddenFromAddressListsEnabled work with New-MailContact?

New-MailContact does not accept that parameter. Create the mail contact first, then run Set-MailContact -Identity "contact@example.com" -HiddenFromAddressListsEnabled $true.

How can I check whether a contact is hidden?

In Exchange Online PowerShell, run Get-MailContact -Identity "contact@example.com" | Format-List DisplayName,HiddenFromAddressListsEnabled. The setting should show True.

Does hiding a contact prevent people from emailing it?

No. Hiding a contact removes it from address lists; it does not prevent someone who knows the address from sending email to it.

What should I do if a contact was created but was not hidden?

Check the PowerShell warning, resolve the reported issue, and run Set-MailContact -Identity "contact@example.com" -HiddenFromAddressListsEnabled $true. Then verify the setting with Get-MailContact.