Welcome to Dream.In.Code
Become a VB Expert!

Join 149,480 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,462 people online right now. Registration is fast and FREE... Join Now!




How can I populate a combo box with a user's Outlook express Addre

 
Reply to this topicStart new topic

How can I populate a combo box with a user's Outlook express Addre

rotortorque
2 May, 2007 - 08:28 AM
Post #1

New D.I.C Head
*

Joined: 2 May, 2007
Posts: 1


My Contributions
I have written an application using VB 2005 that populates a combo box with email addresses from the user's Outlook Address book. It works great with Outlook but I can't get it to work with Outlook Express. How can i get it to work with Outlook Express?

Here is the code that works with Outlook (I found the code from the web):

CODE


    Sub Main()
        ' Create Outlook application.
        Dim oApp As Outlook.Application = New Outlook.Application()

        ' Get NameSpace and Logon.
        Dim oNS As Outlook.NameSpace = oApp.GetNamespace("mapi")
        oNS.Logon("Outlook", Missing.Value, False, True) ' TODO:

        ' Get the first contact from the Contacts folder.
        Dim cContacts As Outlook.MAPIFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)
        Dim oItems As Outlook.Items = cContacts.Items

        'Dim oCt As Outlook.ContactItem
        Dim oCt As Outlook.ContactItem

        Try

            oCt = oItems.GetFirst()
            'Display some common properties.
            Console.WriteLine(oCt.FirstName)
            Console.WriteLine(oCt.Title)
            Console.WriteLine(oCt.CompanyName)
            Console.WriteLine(oCt.Body)
            Console.WriteLine(oCt.FileAs)
            Console.WriteLine(oCt.Email1Address)
            Console.WriteLine(oCt.Subject)
            Console.WriteLine(oCt.JobTitle)

        Catch

            Console.WriteLine("an error occurred")

        Finally

            ' Display
            'oCt.Display(True)

            ' Log off.
            'oNS.Logoff()

            '' Clean up.
            'oApp = Nothing
            'oNS = Nothing
            'oItems = Nothing
            'oCt = Nothing
        End Try
    End Sub
End Module


Thanks in advance,
RotorTorque
User is offlineProfile CardPM
+Quote Post

NickDMax
RE: How Can I Populate A Combo Box With A User's Outlook Express Addre
2 May, 2007 - 09:03 PM
Post #2

2B||!2B
Group Icon

Joined: 18 Feb, 2007
Posts: 2,867



Thanked: 53 times
Dream Kudos: 550
My Contributions
I wish I could answer your question. It seems that microsoft does not really like people programming for Outlook Express... There are a number of 3rd party API's for outlook express (none of them are free as far as I know).

Lucky for you OE use WAB (windows address book) as a way of storeing its addresses and the makers of OEAPI have a free little activeX control that is supposed to support WAB.

Microsoft actually supports an WAB-API

I have seen a couple of write-ups on extracting messages from OE but not too many on addresses
User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 04:18PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month