programmatically saving outlook contacts

B

bahr

Hello, I am writing a program in VB.net that goes out to an SQL database to
get a contact list and imports them into the users Outlook Contacts.
Everything is working fine except, I am also creating a contact folder under
the default Contacts folder and I would like to save the contacts, that i'm
importing, into the created folder but I have found no way to do this thus
far. Is there a simple way to just set the default folder to the folder that
I create?? Much thanks to everyone that has some input
 
D

Dick Kusleika

bahr

You need to use the Add method of the Items collection object instead of
CreateObject. For instance, in VBA, you might write

With
olApp.GetNameSpace("MAPI").GetDefaultFolder(olFolderContacts).Folders("MyFolder").Items.Add
.FullName = ...
.BusinessTelephone =
End With

I'm sure the default item for your folder is ContactItem, but if not, you
need to specify the Type argument of the Add method.
 
B

bahr

Thanks, I haven't tried that but it sounds like it should work fine. The
solution I came up with was to just move the contact, after saving it to the
default contacts folder, to the folder that I have created.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top