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

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?

Okay I think I figured it out. After I import the contacts with: import-contactlist -csv -csvdata ([system.io.file]::readallbytes("PATH TO CSV")) -identity USER
I can run this to find and delete each added contact: 
$tcontacts = get-content PATH TO CSV WITH ONLY NAMES
$zcontacts = get-content PATH TO CSV WITH NAMES OF MAILBOXES YOU WANT TO REMOVE CONTACTS FROM
$ccontacts = "null"
$scontacts = "null"
$xcontacts = "null"
foreach ($ccontacts in $tcontacts) {foreach ($scontacts in $zcontacts) {$xcontacts = $scontacts; Search-Mailbox -identity $xcontacts -SearchQuery kind:'contacts', $ccontacts -deletecontent -force}}
I use xcontacts = scontacts because of pointer issues (i think?) but anyway, using
$scontacts for the -identity doesnt work.
This is a pretty rough script, and you guys could probably find a shorter one, but it works! Thanks

Similar Messages

  • How can i import contacts from another AIM account to this new one

    If you reference my last ichat question, you will see that I have had serious problems and had to create a new account.
    How can I import contacts from another AIM account to this new one??

    Hi,
    Use AIM for Mac and use the Export and Import features.
    Other than that it is a question on making sure every Single Buddy has more than just their Screen name in the IChat Address Card so it is added to the Address Book and dragging them back from there
    9:08 PM Thursday; February 7, 2008

  • How can I import contacts into my icloud contacts from an excel file?

    I need to add contacts to my icloud contact data base.  Can I import from an Excel file?
    Thanks,

    Not directly, export from Excel to a .csv file, then convert the .csv file to a .vcf (vCard) file. Then iCloud can import the vCard file.
    Here is a free csv to vcard conversion utility.

  • How can I import from a MiniDV tape and keep the clip order

    A long time ago, I edited some MiniDV video together and recorded back out to a MiniDV tape using some older version of iMovie (ten years ago). I have latest version of iMovie (10.0.2) and have imported all of the edited video back into a new library. Unfortunately, the library is separating the video into separate clips and sorting them by the original timestamps of the original video (before editing). As a result, the clip are in a jumbled mess of an order.
    Note that I am just importing the video from the MiniDV tapes so that I can export it as a Quicktime file. I really don't need the video to be split into clips at all. I would actually prefer to just import the entire video as one big clip.
    Any idea how I can preserve the order of the

    One thing that I have noticed is that Apples built-in camera is optimized for Face Time, so it sometimes captures at 30 frames per second, but if there is not a lot of motion in the frame, it might use 12 or 15 frames per second. So it has variable frame rates. This is great for FaceTime, but not so great if you are trying to keep the audio in sync.
    The way to fix this is to use QuickTime Pro or MPEG Streamclip to save the movie out with identical specs except to specify 30 frames per second (or 25 in a PAL country).
    I wonder if you are running into a similar problem in QTPlayer. If it is making a variable frame rate movie, you could fix it by dragging the movie into MPEG Streamclip and exporting as the same kind of movie, but with a fixed 30 fps frame rate. MPEG Streamclip is free and quite useful for stuff like this.
    Just a thought.
    Right now my QuickTime Player is hanging so I can't test to see if you could set the frame rate directly in QuickTime Player X.

  • How can I import contacts into phone from Excel fi...

    I have an N97 Mini. And I have an Excel file on my computer which lists my contacts. In separate columns I have their first names, last names, phone numbers, email addresses.I would like to import this file into my phone's contacts in one go, i.e. without having to enter each person manually. Does anyone know who this can be done?
    (Also, in another folder I have a profile photograph of each contact. Is there some way I could also - in one go - add a profile picture to each contact in my phone's contacts?) 
    FYI: I have Ovi Suite and PC Suite installed on my computer, but it's not clear whether they could help with this. Thanks.

    Exporting .csv ( comma seperated value) and Excel files to Outlook and then sync through PCSuite is possible. For the pictures, I'm not sure.
    ‡Thank you for hitting the Blue/Green Star button‡
    N8-00 RM 596 V:111.030.0609; E71-1(05) RM 346 V: 500.21.009

  • How can i import contacts from a csv file to "iCloud Contacts"?

    How can I import contacts from a csv file to "iCloud Contacts"?

    The only way I know of to import cells from a csv file is by creating a new file.  But then you can select the desired cells and copy them to the other file.  I just did it to be sure it works.
    1. Create the new spreadsheet file via the upload command.
    2. Select the cells (table) that you want to move to the other file and press command+C (copy).
    3. Close the new file and open the existing file.
    4. Select the top/right cell of the area to receive the copied "table" and press commant+V (paste).
    I hope this is what you're trying to do!

  • How can i import contacts from my regular sim to iphone 5 (nano sim)

    how can i import contacts from my regular sim to iphone 5 (nano sim)

    Sync the phone with the regular sim to the appropriate program on your
    computer. When you set up the iPhone 5 in iTunes on that computer, you
    will be offered the chance to import the contacts, etc.
    Or take old phone and new iPhone to your wireless provider. They have the
    equipment to do this quickly.

  • How can I import contacts from iCloud to CONTACTS in snow leopard? !

    After upgrade software on iPhone (with iCloud) contacts on MAC (Snow Leopard) are no mre sync with iPhone....
    As some time hase passed by and I did not notice it immediatly, now I have all updated contacts on iCloud and no moe on Mac;  how can I import contacts from iCloud to Mac contacts in snow leopard?
    Thanks for help !!!!
    Marco
    PS sorrry, previous question was a mistake

    At http://icloud.com go to the Contacts page. Select all your contacts, click the cogwheel icon at bottom left and select 'Export vCard'.
    Now open Address Book on your Mac. From the File menu choose 'Import' and select your exported file. Of course if it contains entries which are also on the Mac you will get duplicates.

  • How can I import contacts from iCloud to iCal in snow leopard?

    After upgrade software on iPhone (with iCloud) contacts of iCal on MAC (Snow Leopard) are no mre sync... with iPhone....
    As now I have all updated contacts on iCloud, how can I import contacts from iCloud to iCal in snow leopard?
    Thanks for help !!!!
    Marco

    Log in to icloud.com
    Select Contacts
    Click on the first contact
    Hold down shift and click on the last contact
    Click the gear box at the bottom of the screen
    Choose "Export vcard..."

  • How can I import video into iMovie from a DVD?

    How can I import video into iMovie from a DVD?
    Thanks,
    Doug Davis

    You can do this with a free app called MPEG Streamclip and a $20 quicktime component from Apple.
    See detailed instructions here.
    https://discussions.apple.com/docs/DOC-3951

  • How can I import music into iTunes from other media .I have music which was downloaded from my Sony Ericcson W715 into "Media Go" and I want to transfer it into iTunes.Is this possible ?

    How can I import music into iTunes from another media.
    I have a library downloaded from a Sony Ericsson W715 into "Media Go" and I want to transfer to iTunes and then into my iPhone 4.
    Is this possible ?
    Chris
    <Email Edited by Host>

    chrisfromgoodworth clatford wrote:
    How can I import music into iTunes from another media.
    I have a library downloaded from a Sony Ericsson W715 into "Media Go" and I want to transfer to iTunes and then into my iPhone 4.
    Is this possible ?
    Chris
    Possibly. Media Go supports a variety of music formats, some of which can be imported in to iTunes and then synced on to an iPhone, however some of its formats cannot be imported in to iTunes.
    See http://mediago.sony.com/enu/supported-file-formats/ for a list of formats supported by Media Go. iTunes for Windows supports MP3, AAC, WAV, and can import and convert WMA files as well. However iTunes does not support ATRAC, or FLAC.
    Furthermore, if some of your music has been bought from an Internet music store it might be procted by DRM. If so it cannot be imported in to iTunes.
    To do the importing you would either drag the music files in to iTunes, or tell iTunes to open them. See http://support.apple.com/kb/ht1347

  • How can I drag contacts into numbers like the old version?

    How can I drag contacts into numbers like the old version?

    Copy and paste works.  But drag and drop is also back in version 3.2. It works well here. Just drag and drop onto the canvas.Make sure you've upgraded to version 3.2 as earlier versions of Number 3 did not support drag and drop from Contacts.
    Note that the column headers are misaligned if you are dragging contacts that do not contain an image.  But the information in the body of the table drags in correctly.
    SG

  • I have Calendar v 7.0 and Entourage 12.3.6 2008 on OS X 10.9.2. I cannot import Entourage events into Calendar - this was never an issue with iCal. Whats happened and how can I import details into Calendar or do I need iCal back?

    I have Calendar v 7.0 and Entourage 12.3.6 2008 on OS X 10.9.2. I cannot import Entourage events into Calendar - this was never an issue with iCal. Whats happened and how can I import details into Calendar or do I need iCal back?

    adamboettiger wrote:
    Sophos and MacKeeper
    There are many reported problems with both these programs.
    Run through this list of fixes in order, will tune you right up.
    They are in order for a reason.
    ..Step by Step to fix your Mac

  • When I listen to music on Apple TV 2 my pictures from iPhoto come in, but always the same album (which I nevr asked for), always in random order and always in a different format. How can I control what is going on and choose the album myself.

    When I listen to music on Apple TV 2 my pictures from iPhoto come in aafter about ten minutes, but always the same album (which I never asked for), always in random order and always in a different format. How can I choose a different album myself and control the order and format?

    Thank you Winston for a helpful response and for reminding me of something which I found nearly a year ago and then lost (in my mind) because I did not use it. I am grateful for a correct answer but it still only achieves part of what I wanted.
    I can now choose my photos, decide how long they stay on screen and choose one of a variety of presentations. Two things I still can't do.
    One is to get it to play the photos in the chronological order in which I have carefully set them in an album; it still tends to be random and repetitive. The other is that I cannot get any of them them to saty on screen for more than about 20 seconds. I guess this is all due to the way Apple TV is constructed.
    But still thanks, nevertheless.
    Alec

  • How can I purchase an iTunes card online and get the code online to purchase apps.

    How can I purchase an iTunes card online and get the code online to purchase apps.

    iTunes Gift Options
    http://support.apple.com/kb/HT2736

Maybe you are looking for

  • ICal Calendar Colors Changing by Themselves

    I have two devices that sync with my iCloud account, a Macbook Pro and an iPhone 5. I primarily use iCloud to sync my calendar, notes, and reminders. By some reason when I got home from work last night, the color of every calendar in iCal (on the Mac

  • Since upgrading to 5.4 LR uses todae instead of photo creation date.  How to fix this?y's dat

    since upgrading to 5.4 on a mac, LR persists in using today's date instead of photo creation date when i use "Date" as part of renaming template.  never did this when using 5.3.   i rename images on import.  Please help if anyone knows how to fix thi

  • New iPod Touch & TV connection

    Hi all, I just got a new iPod Touch. It was my understanding that its precedesor had an Video Out port so you can connect it to a TV and watch videos. If this incorrect on my part I apologize. I tried to connect the new iPod Touch to the TV using a s

  • DPM - DPM protection 2012r2

    I have two dpm2012 r2 servers both running on windows server 2012 r2.  They are at different data centers connected with a 100m point to point with latency <10ms.  Lets call them dpm01 and dpm02 dpm01 is at datacenter 1 fw disabled ^ 100mbit currentl

  • Strange problem with exchange

    Hi to everyone, I've a big problem with my work exchange account. When I add it in my iphone, I insert all data, and iphone say to me that's all ok and that I can sync all. But when I go to inbox, I receive the error that I can't connect to inbox. Wh