Import Contacts to Office 365 via PowerShell

So first I had to get what fields I could import from Exchange and you can do that by logging into your Exchange Organization via PowerShell and then typing in the cmdlet “Get-Contact | FL” this will give you a list out of all the available fields that go with a contact. Now you can even go further and type in “Get-Contact | Export-CSV c:filename.csv” and it will spit it all out for to a .csv file which you can use as a template. Beware that this does also make fields that contain Office 365 specific data so you can’t use all of those fields so you’ll have to find out which ones you can’t use. _

Ready to discuss your IT needs? Please check us out for your Managed Service or Cloud Consulting needs._

1). Prepare CSV file, this file should contain all attributes you want to use for your external contact, here is the file I used.

“Name”,”ExternalEmailAddress” “Amy Smith”,”Amy.Smith@AgileIT.com” “Lynn McCade”,”Lynn.McCade@AgileIT.com

2). Create external contact using following cmdlet:

Import-Csv d:Contacts.csv|%{New-MailContact -Name $_.Name -ExternalEmailAddress}

Great you’ve just imported your contacts now it’s time to populate the information. You can do that by creating another .csv file with the fields you got from that Get-Contact | export-csv command earlier.

1.) Make sure your CSV file is filled out properly “Name”,”MobilePhone”,”StreetAddress”,”WorkPhone” “Amy Smith”,”6198675309”,”1204 Mission Blvd.,San Diego, CA,90129”,”6198675309” “Lynn McCade”,”8588675309”,”1204 Mission Blvd.,San Diego, CA,90129”,”85886753099”

2). Set the external contact with proper attributes.

Import-Csv d:Contacts.csv|%{Set-Contact -Identity $_.Name -MobilePhone $_.MobilePhone -StreetAddress $_.StreetAddress –WorkPhone $_.WorkPhone}

Congratulations!! You’ve now imported your contacts into your GAL.

Please check us out for your Managed Service or Cloud Consulting needs.

ON THIS PAGE

Looking to hire an MSP for CMMC?

Click the button below now.

Lorem ipsum dolor sit amet,

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec

Compliance Isn't a Checkbox

It’s contract eligibility. Agile IT builds, secures, and validates Microsoft 365, GCC High, and Azure environments for organizations facing CMMC, NIST 800-171, and CUI requirements. If a failed audit would cost you contracts, talk to us before it does.

Related Posts

What Counts as CUI in Microsoft 365 and Azure Government

Most CUI scope decisions get made in one meeting, by whoever is in the room, and documented afterward to match. That boundary holds until a C3PAO asks who justified it. The designating agency decides what qualifies. Data flow decides what’s in scope. The Microsoft environment follows both, not the reverse.

Read More »