Import contacts from CSV file into Exchange 2007
Is there a way to import 2500 contacts from CSV file into Exchange 2007 Please? Thank you in advance. mxarun
April 22nd, 2007 9:56am

You can use CSVDE to do this. Here's a sample import for user objects: http://www.activedir.org/Downloads/Files/200Users.zip Tony
Free Windows Admin Tool Kit Click here and download it now
April 23rd, 2007 12:09am

thanks a lot. this will help a lot. highly appriciated arun
April 23rd, 2007 12:15am

Is it possible to import not only mailboxes, but messages using CSVDE?Thanks,Jason
Free Windows Admin Tool Kit Click here and download it now
July 6th, 2007 8:07pm

No, it's not. What is it you are trying to achieve? Depending on what you want to do, you might want to have a look at Exmerge. Tony
July 10th, 2007 11:12pm

Exchange 2007 equivalent not available till SP1 http://msexchangeteam.com/archive/2007/04/13/437745.aspx
Free Windows Admin Tool Kit Click here and download it now
July 10th, 2007 11:28pm

Correct, although Exmerge is not "actively blocked" by Exchange 2007 if run from a downlevel client machine. http://msexchangeteam.com/archive/2006/11/28/431669.aspx In other it should still work....for now. Tony
July 11th, 2007 3:36am

It may be too late to help you, but I am posting this for others searching on this issue. I have written a powershell script that takes a default csv export from outlook and imports it into exchange 2007. Not every field is brought over as there are inconsistencies in the information you are able to store. It should be pretty easy to modify it to make it work for any fields that are missing. One of thefields/parameters I left out was -CountryorRegion as it is not a string field and I did not want to do the conversion. Here it is: Add-Content c:\debug.txt ":tarting Import: "; $err = ""; Import-Csv contacts.csv | ForEach { $output = "::"; $display = ""; if ($_."First Name") { $display = $_."First Name"; } if($_."Middle Name") { $display = $display + " " + $_."Middle Name"; } if($_."Last Name") { if ($_."First Name") { $display = $display + " " + $_."Last Name"; } else { $display = $_."Last Name"; } } $output = $output + "Importing: " + $display; Add-Content c:\debug.txt $output; $otherfax = $_."Home Fax" + ", " + $_."Other Fax"; $otherphone = $_."Primary Phone" + ", " + $_."Business Phone 2" + ", " + $_."Car Phone" + ", " + $_."Callback" + ", " + $_."Company Main Phone" + ", " + $_."Other Phone"; $otherhome = $_."Home Phone 2" + ", " + ""; $businessstreet = $_."Business Street" + " " + $_."Business Street 2" + " " + $_."Business Street 3"; $postofficebox = $_."Business Address PO Box" + ", " + ""; New-MailContact -DomainController dc.domain.com -Name $display -Firstname $_."First Name" -Lastname $_."Last Name" -ExternalEmailAddress $_."E-mail Address" -OrganizationalUnit "domain.com/Contacts" -ErrorAction SilentlyContinue -ErrorVariable +err | Set-Contact -DomainController dc.domain.com -AssistantName $_."Assistant's Name" -City $_."Business City" -Company $_."Company" -Department $_."Department" -DisplayName $display -Fax $_."Business Fax" -HomePhone $_."Home Phone" -Initials $_."Initials" -MobilePhone $_."Mobile Phone" -Name $display -Notes $_."Notes" -Office $_."Location" -OtherFax $otherfax -OtherHomePhone $otherhome -OtherTelephone $otherphone -Pager $_."Pager" -Phone $_."Business Phone" -PostalCode $_."Business Postal Code" -PostOfficeBox $postofficebox -StateOrProvince $_."Business State" -StreetAddress $businessstreet -TelephoneAssistant $_."Assistant's Phone" -Title $_."Title" -WebPage $_."Web Page" -ErrorAction SilentlyContinue -ErrorVariable +err; Set-MailContact -Identity $display -DomainController dc.domain.com -CustomAttribute15 "Bristol" -ErrorAction SilentlyContinue -ErrorVariable +err; } Add-Content c:\debug.txt $err; Hope this helps someone! It was not a quick process, but I had tons of contacts to import.
Free Windows Admin Tool Kit Click here and download it now
January 3rd, 2008 1:37am

You posted a link for a sample script for importing contacts into Exchange 2007 .. the url is no longer available. Can you repost ... greatly appreciated. (tmiles@sssd.k12.co.us) ... tks tim
April 11th, 2008 11:38pm

Here is my final script. There are some aspects that are custom to my environment. If you have any questions, please let me know. Code Snippet Add-Content c:\debug.txt "::Starting Import: ";$err = "";int $fakecounter = 1;Import-CSV contacts.csv | ForEach { $output = "::";$display = "";$email = $_."E-mail Address";$fakecounter++;if ($_."First Name") { $display = $_."First Name";} if($_."Middle Name") { $display = $display + " " + $_."Middle Name";} if($_."Last Name") { if ($_."First Name") { $display = $display + " " + $_."Last Name";} else { $display = $_."Last Name";} } if($display){} else{$display = $_."Company"}$output = $output + "Importing: " + $display;Add-Content c:\debug.txt $output;$otherfax = $_."Home Fax" + ", " + $_."Other Fax";$otherphone = $_."Primary Phone" + ", " + $_."Business Phone 2" + ", " + $_."Car Phone" + ", " + $_."Callback" + ", " + $_."Company Main Phone" + ", " + $_."Other Phone";$otherhome = $_."Home Phone 2" + ", " + "";$businessstreet = $_."Business Street" + " " + $_."Business Street 2" + " " + $_."Business Street 3";$postofficebox = $_."Business Address PO Box" + ", " + "";$initials = $_."Initials";$notes = $_."Notes"; if($initials.Length -gt 6){$initials = $initials.Substring(0, 6);} if($Notes.Length -gt 1022){$notes = $notes.Substring(0, 1022);} if($email -like "*@*"){New-MailContact -DomainController dc.contoso.com -Name $display -Firstname $_."First Name" -Lastname $_."Last Name" -ExternalEmailAddress $email -OrganizationalUnit "contoso.com/OU/Contacts" -ErrorAction SilentlyContinue -ErrorVariable +err | Set-Contact -DomainController dc.contoso.com -AssistantName $_."Assistant's Name" -City $_."Business City" -Company $_."Company" -Department $_."Department" -DisplayName $display -Fax $_."Business Fax" -HomePhone $_."Home Phone" -Initials $initials -MobilePhone $_."Mobile Phone" -Name $display -Notes $notes -Office $_."Location" -OtherFax $otherfax -OtherHomePhone $otherhome -OtherTelephone $otherphone -Pager $_."Pager" -Phone $_."Business Phone" -PostalCode $_."Business Postal Code" -PostOfficeBox $postofficebox -StateOrProvince $_."Business State" -StreetAddress $businessstreet -TelephoneAssistant $_."Assistant's Phone" -Title $_."Title" -WebPage $_."Web Page" -ErrorAction SilentlyContinue -ErrorVariable +err;} else{$email = "blank" + $($fakecounter) + "@contoso.com";New-MailContact -DomainController dc.contoso.com -Name $display -Firstname $_."First Name" -Lastname $_."Last Name" -ExternalEmailAddress $email -OrganizationalUnit "contoso.com/OU/Contacts" -ErrorAction SilentlyContinue -ErrorVariable +err | Set-Contact -DomainController dc.contoso.com -AssistantName $_."Assistant's Name" -City $_."Business City" -Company $_."Company" -Department $_."Department" -DisplayName $display -Fax $_."Business Fax" -HomePhone $_."Home Phone" -Initials $initials -MobilePhone $_."Mobile Phone" -Name $display -Notes $notes -Office $_."Location" -OtherFax $otherfax -OtherHomePhone $otherhome -OtherTelephone $otherphone -Pager $_."Pager" -Phone $_."Business Phone" -PostalCode $_."Business Postal Code" -PostOfficeBox $postofficebox -StateOrProvince $_."Business State" -StreetAddress $businessstreet -TelephoneAssistant $_."Assistant's Phone" -Title $_."Title" -WebPage $_."Web Page" -ErrorAction SilentlyContinue -ErrorVariable +err;}Set-MailContact -Identity $display -DomainController dc.contoso.com -CustomAttribute15 "Import" -ErrorAction SilentlyContinue -ErrorVariable +err;}Add-Content c:\debug.txt $err;
Free Windows Admin Tool Kit Click here and download it now
April 12th, 2008 12:35am

Hazar1: I'm new to Exchange powershell scripting. I have two questions: 1) In this code, what aspects of it are custom, and 2) What fields from the CSV file will not get imported properly into the contacts with this code?Vic
May 19th, 2008 3:38am

Vic, The only field that I know for sure will not get imported is Country (in order to import it you have to convert it from general text into a specific code and I did not have the time to figure out how best to do the conversion). I am sure there are some more, but honestly I don't remember what they were as they were not used in my contact list. The easiest way to find out what fields are missing would be to take a CSV export from outlook and compare or find the field in the script to see if they were brought over and what field I chose to put them in. As far as what is custom to my environment. There are a lot more fields in the contact list from outlook than are available in the contact object in Exchange/AD. So, I had to choose how I wanted to get that information into the object. For example, there are quite a few phone number fields in an outlook contact so I had to make the decision on what to use for the phone/home phonefields and then lump any others in the OtherTelephone and OtherHomePhone fields (btw, the "Other Telephone" and "Other Home Phone" field did not fill as expected so this is one area of the script that needs some work). The other custom changes are not as noticable because I changed attributes custom to my environment to generic terms. For example, near the end of the script I updated "CustomAttribute15" to the location from which I was importing the contacts so that I could then create a custom address list to show only those contacts. In the generic version of the script, I replaced the location with "Import". Anyway, I hope this helps. I am sure there are many improvements that can be made to this script, but I only had so much time to work on it. It works for what I needed to accomplish. Good luck, and let me know if you have any other questions as you look over the script. -David
Free Windows Admin Tool Kit Click here and download it now
May 19th, 2008 4:57pm

You used the "New-MailContact" cmdlet to create this data? This creates contacts in active directory and the exchange address list. Are you saying this script can be used to migrate user's personal contacts from csv to their respective exchange mailbox? If not, and this is not the intention of this script, can you suggest how to accomplish the migration of "USER's" personal contacts into exchange?
June 11th, 2008 11:30pm

This script is intended to take personal contacts from outlook and add them to the Exchange Global Address List. We had a public folder with a bunch of contacts that we needed to put in the GAL so they could be searched on cell phones with ActiveSync. I copied the public folder to my personal contacts in outlook, exported them to csv, and using this script created mail contacts. These contacts show up in the GAL, but I also added custom attributes so that I could create seperate Address Lists. So, yes it creates contacts in active directory and the exchange address list. I am not sure I understand exactly what this question means: ////////////////////////////////////// Are you saying this script can be used to migrate user's personal contacts from csv to their respective exchange mailbox? ////////////////////////////////////// If I am reading it correctly, you are wanting to take contacts stored in a CSV file and import them into the server-side personal contacts of one or more of you exchange users. The script is not able to do this. However, once the contacts are loaded into the GAL, users could copy them to their personal contacts.
Free Windows Admin Tool Kit Click here and download it now
June 12th, 2008 12:03am

Thanks for the clarification. Here's what I was hoping for: http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=3461626&SiteID=17
June 12th, 2008 8:20pm

Let me preface this by saying that I know that these are not perfect solutions as they require users to perform some of the tasks, but if you can't find any other solutions they may work for you. Will Outlook connect to the IMAP service and read the contacts? If so, you could provide you users with instructions on how to connect to both Exchange and IMAP and then instructions on how to copy their contacts into Exchange. Also, there is an import functionality in Outlook that you could provide instructions for. I am assuming the csvexport would be the same for all users so once you figurethe importout once it should be easy to replicate. Another option would be to use a modified version of the script to import the contacts into the GAL. Make sure that you fill a custom attribute field to show that this contact was importedand which user it belonged to. Then, you can pretty easily create address lists for each user (You can probably create a script to do this also). Send out instructions showing the users how to connect to the correct address list in the 'Address Book' and have them copy them to the contacts folder in their mailbox. Then, when everyone is finished, you can delete all of the records from the GAL based on the custom attribute. Good luck, David
Free Windows Admin Tool Kit Click here and download it now
June 12th, 2008 9:40pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics