Adding Global Contacts for an Office 365 Tenant

Exchange Public Folders or Mail Contacts

A recent post to the Office 365 Technical Discussions Facebook group came from a small Office 365 tenant (a voluntary fire brigade with 47 members) who wanted to share global contacts such as the town mayor or local companies. The only solution they had discovered was to create a public folder to hold contacts. This will work, but it’s an Outlook-only solution because Outlook is the only email client that understands how to use the shared contacts from a public folder as an address list (see below)

How contacts stored in an Exchange Online public folder show up in an Outlook address book
The Essential People public folder stores contacts and shows up in Outlook as an address list

Mail Contacts Have Best Client Support

Given the widespread use of mobile devices and the undesirability of setting up and managing public folders in a small Office 365 tenant, mail contacts seem like a better approach. A mail contact is an object created in Exchange for someone outside your organization. Each contact has an email address and other properties that you’d expect to find in an address book, such as first and last name, display name, mailing address, and phone numbers. The email address used for a mail contact must be unique. In other words, it cannot be assigned to another mail-enabled object already known to your organization (including guest user accounts).

Mail contacts are included in the Exchange Global Address List (GAL) and Offline Address Book (OAB), so they are available to all the Microsoft email clients – Outlook desktop (Windows and Mac), OWA, and Outlook for iOS and Android. Because mail contacts exist in the Exchange directory, they are also available to third-party email clients, if those clients choose to include the necessary support (here’s one example that does).

The Downside of Mail Contacts

The downside of mail contacts is that these objects can only be added by an Exchange administrator (or more precisely, an account that has been assigned the Mail Recipients RBAC role). Once your account has the necessary permissions, it can add or update mail contacts using the Office 365 Admin Center (Users – Contacts), the Recipients section of the Exchange Admin Center (EAC), or by running the New-MailContact PowerShell cmdlet.

Adding a new mail contact to Exchange Online via the Office 365 Admin Center
Adding a mail contact through the Office 365 Admin Center

Use PowerShell to Import Contacts from a CSV File

One way to approach the problem is to ask someone who doesn’t have administrative permission to maintain a CSV file holding details of the common contacts. You can add as many of the properties supported by Exchange for mail contacts as you wish. Once the file is ready, PowerShell can process its contents.

A CSV file used to import contacts to Exchange Online
The Input Contacts CSV file

This very simple PowerShell code reads the CSV file shown above and creates a new mail contact for each line found in the file. Note that the New-MailContact cmdlet creates a new mail contact and the Set-Contact cmdlet updates some of the extended properties, like phone numbers.

Free Book about Eradicating Public Folders

If your organization is considering moving from public folders, consider reading the eBook “The Complete Guide to Eradicating Legacy Public Folders” to get some ideas for how you might approach the task.

For more information about public folders, see Chapter 8 of the companion volume for the Office 365 for IT Pros eBook. Mail contacts are covered in Chapter 7 of the main book. You get both the main and companion volumes when you subscribe to Office 365 for IT Pros.


5 Replies to “Adding Global Contacts for an Office 365 Tenant”

  1. I cant get this to work, i finds all the contact in the csv but dosent import them and i get no errors.
    any ideas?

    1. Have you tried running the script in the PowerShell ISE to see what’s happening? Does your account have the mail recipient role that’s needed to add mail contacts?

  2. Hi,
    Im running it in powershell ise and doing it with admin account. But it seems as i get some varieable error.

    1. And what error do you see? It’s kind of hard to debug when you don’t give full details.

      1. Hi, i found the issue i needed to do the import-csv with -Delimiter ‘;’ for it to work.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.