Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

How can I import contacts into a mailbox and overwrite the previous ones?

$
0
0

Hey guys, so I am new to powershell. I understand some of the basics and am still trying to teach myself as much as I can.

So I have been asked to automatically push our company's contacts to everyone's mailbox (around 60-70 contacts to 60-70 mailboxes) We use Office 365.

They also want the contacts to sync to mobile phones, so I cannot used a shared contact list. It seems only the MAIN contact list can sync to a phone.

So far I have used this:import-contactlist -csv -csvdata ([system.io.file]::readallbytes("PATH TO CSV FILE")) -identity USER

This works just fine, but if there are any changes to the CSV and I run it again, it just doubles all the contacts instead of overwriting. Is there anyway I can overwrite the contacts?

I have also tried this:Search-Mailbox -identity USER -SearchQuery kind:contacts -deletecontent

This does delete the contacts I have created in the first place, but if there are any OTHER contacts that users have created, it would delete those as well.

I feel like im headed in the right direction.. can anyone help?


Viewing all articles
Browse latest Browse all 21975

Trending Articles