Office 365 doesn’t offer you a way to easily import a list of contacts into your company’s Global Address List (GAL). But it can be done quite easily with Powershell and a csv file of the contacts to import.
First of all the csv file. There are some mandatory fields and some optional ones. The mandatory fields are:
- ExternalEmailAddress
- Name
- FirstName
- LastName
You can download a sample csv file here. Delete the sample data. You’ll notice it has extra columns, you can delete them or fill out the info, we can import this extra data later.
If any column is left blank, it will not be imported into the GAL.
Save this file to C: Drive.
Connect Powershell to office 365
Type in this command to create the contacts with basic information.
1 |
Import-Csv C:\ExternalContacts.csv|%{New-MailContact -Name $_.Name -DisplayName $_.Name -ExternalEmailAddress $_.ExternalEmailAddress -FirstName $_.FirstName -LastName $_.LastName} |
to import the extra data we run 2 commands:
1 |
$Contacts = Import-CSV C:\ExternalContacts.csv |
1 |
$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} |
No Comments