Import Contacts into Outlook 2003 from CSV
Posted on 2006-05-26
Currently I have a CSV file, non-standard headers sadly (as in ADDR1 instead of Address1), and I need it to import each record into Outlook as a contact.
I can do it manually but I want to do it using VB.NET (Visual Studio 2005 if it matters).
I know there are better ways but what I was considering was to read the CSV into an array and split the records up. Then put that into Outlook.
You would just Loop this for each record I assume:
Dim olApp As Outlook.Application
olApp = CreateObject("Outlook.Application")
Dim olNs As Outlook.NameSpace
olNs = olApp.GetNamespace("MAPI")
Dim olItem As Outlook.ContactItem
olItem = olApp.CreateItem(olContactItem)
.FullName = Name
.Birthday = BDay
.CompanyName = Company
.HomeTelephoneNumber = Phone
.Email1Address = Email
.JobTitle = Job
.HomeAddress = ADDR
The problem I have is loading the CSV and splitting it up into variables that I can loop through.
Also the actual data I need is only Name, Company, and Phone number. The rest is just a bonus. I'm eventually going to schedule this to happen weekly, no Forms needed just a Console App.