Quantcast
Channel: MSDN Blogs
Viewing all articles
Browse latest Browse all 12366

Importing Office 365 contacts en mass using Power Shell

$
0
0

One of the less pleasant parts of my role is adding people to distribution lists….

The Office365 UI certainly doesn’t make this easy!

Turns out it is pretty easy with Power Shell..

Saving all my contacts to a CSV you can add contacts en mass using the following commands:

$cred = Get-Credential
$s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri
https://ps.outlook.com/powershell -Credential $cred -Authentication Basic -AllowRedirection
$importresults = Import-PSSession $s

$Contacts = Import-CSV .\contacts.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}


Viewing all articles
Browse latest Browse all 12366

Trending Articles