|
hazar -> RE: How to import outlook contacts to exchange 2007 (2.Jan.2008 5:33:05 PM)
|
ntusnet, 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 fields/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 "::Starting 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.
|
|
|
|