Bulk Import Contacts to Office 365 Global Address List

You may have noticed that the Office 365 portal doesn’t offer you a way to easily import a list of contacts into your company’s Global Address List (GAL). In order to bulk import contacts, you would need to use PowerShell. Here are instructions on how to use PowerShell.

Gathering Contacts

1. Download an External Contacts CSVand open it up in a program like Excel.

2. Delete the sample data.

3. Collect your contact data and fill out the columns. You must provide an email address for each contact. If any of your contacts do not have an email address, do not add them to this list because they cannot be imported. It’s recommended that you fill out these columns for each contact.

  • ExternalEmailAddress
  • Name
  • FirstName
  • LastName

4. The other columns are optional. If any column is left blank, it will not be imported into the GAL.

Set up PowerShell 3.0

If you haven’t used PowerShell before, we will first need to configure your computer to use PowerShell with Office 365. If you have Windows 8, Windows 8.1, or Windows server 2012, you can start on step 3.

1. Install Microsoft .NET Framework 4.0 or Microsoft .NET Framework 4.5. You don’t need to install both.

2. Install Windows Management Framework 3.0.

3. Click on the Start icon on your desktop and search for “PowerShell”.

4. Right click on “Windows PowerShell” and select “Run as administrator”.

5. In the PowerShell window, type this command

Set-ExecutionPolicy RemoteSigned

6. When asked if you want to change the execution policy, type “Y” and then press the “Enter” key.

Powershell1

Import Contacts with PowerShell

1. Click on the Start icon on your desktop and search for “PowerShell” and click on it to open PowerShell.

2. Type in this command and enter in your Office 365 Global Admin credentials.

$Cred = Get-Credential

3. Type in this line to create your remote session to Office 365.

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic –AllowRedirection

4. Type in this line to start the session.

Import-PSSession $Session

5. If you do not get any errors running the above lines, you are finally connected to Office 365 with PowerShell. We can now start importing the contacts.

6. Rename the CSV file to something simpler like “ExternalContacts.csv” and place the file in C:.

7. Type in this command to create the contacts with basic information.

Import-Csv C:ExternalContacts.csv|%{New-MailContact -Name $_.Name -DisplayName $_.Name -ExternalEmailAddress $_.ExternalEmailAddress -FirstName $_.FirstName -LastName $_.LastName}

8. Now that the contacts have been created, we will run these two commands to fill in the rest of the information.

$Contacts = Import-CSV C:ExternalContacts.csv

$contacts | ForEach {Set-Contact $_.Name -StreetAddress $_.StreetAddress -City $_.City -StateorProvince $_.StateorProvince -PostalCode $_.PostalCode -Phone $_.Phone -MobilePhone $_.MobilePhone -Pager $_.Pager -HomePhone $_.HomePhone -Company $_.Company -Title $_.Title -OtherTelephone $_.OtherTelephone -Department $_.Department -Fax $_.Fax -Initials $_.Initials -Notes $_.Notes -Office $_.Office -Manager $_.Manager}

 

Get expert guidance from your trusted advisor

Contact us today to discuss how we can unleash the power of technology for your business