This was a ripper of a project. It allowed me to get my hands dirty with PowerShell and using the EWS Managed API with Exchange 2013 SP1.
The code for this came from various sources and I have hand picked the bits I needed to make it all work. I have also had to add code to make the additional fields work and to vet the information that comes in from the CSV.

How is this different to anything else out there? Simple. It contains nearly every field that can be imported into a Contact!! Yep. All those miscellaneous fields and User Fields!!!! Everything else on Google either only does Name and Email Address or does the major fields. So of course my client wanted more!!!!


Here is the Zip for the project. CSVtoPFImport
You will also need the EWS Managed API v2.2

The program runs out of the PowerShell file ContactCSVtoPF.ps1
This calls the Necessary Includes and defines the location of the CSV Files (Yep you can do multiple!) and which Public Folder you want to send each one to. This file will obviously need to be edited to suit your individual needs.

The rest should be history. I had a hard time with the Dates that were coming from the CSV files. Unfortunately I had to modify code in the Called Modules to make this happen. So I am not really sure how this will run for others. It will definitely work for Australians and British as the date format is now dd/MM/yy. If you get errors on your dates edit the ImportOSCEXPFContactImport.psm1under the OSCEXPF folder. On Line 241.

This is the code required for declaring the Extended Fields.

$AddressGuid = new-object Guid(“00062008-0000-0000-C000-000000000046”)
$AddressGuid2 = new-object Guid(“00062004-0000-0000-C000-000000000046”)
$email1DisplayNameProp = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition($AddressGuid,32896, [Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String)
$Title = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x3A45,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$Suffix = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x3A05,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$Account = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x3A00,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$Anniversary = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x3A41,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::SystemTime);
$Gender = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x3A4D,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::Short);
$GovernmentIDNumber = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x3A07,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$Hobby = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x3A43,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$BillingInformation = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition($AddressGuid,0x8535,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$BusinessPOBox = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition($AddressGuid2,0x804A,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$HomePOBox = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x3A5E,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$InternetFreeBusy = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition($AddressGuid2,0x80D8,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$Language = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x3A0C,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$Location = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x3A0D,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$OrganizationalIDnumber = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x3A10,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$OtherPOBox = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x3A64,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$ReferredBy = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x3A47,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$User1 = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition($AddressGuid2,0x804F,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$User2 = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition($AddressGuid2,0x8050,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$User3 = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition($AddressGuid2,0x8051,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$User4 = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition($AddressGuid2,0x8052,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$WebPage = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition($AddressGuid2,0x802B,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);
$Email1DisplayName = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition($AddressGuid2,0x8084,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);

Comment if you need any help.


Leave a Reply

Your email address will not be published. Required fields are marked *