how to upload contacts on office365 by powershell

Modified on Sat, 2 Sep, 2017 at 8:07 PM

Kindly login with administrator in powershell from any windows machine.

and follow the below commands on powershell


1)Set-ExecutionPolicy RemoteSigned

press y


2) $Cred = Get-Credential


type domain portal admin login name & password


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


4) Import-PSSession $Session


5)Import-Csv .\importexcel.csv|%{New-MailContact -Name $_.Name -DisplayName $_.Name -ExternalEmailAddress $_.ExternalEmailAddress -FirstName $_.FirstName -LastName $_.LastName}


Name file : importexcel.csv

make a csv file including column

Name DisplayName ExternalEmailAddress FirstName LastName

chose  MailContact or MailUser


6)Remove-PSSession $Session


7) verify the contact on portal of domain under Microsoft center---exchange---recipient---contact.


DONE.



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article