• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 276
  • Last Modified:

MAPI Address Book

Hello
How can i list my address book from outlook in a listbox in vb6.i can see it with mapimessage.show but i want to list it in listbox
thanks
0
maryam1359
Asked:
maryam1359
2 Solutions
 
hmadhurCommented:
Hi,
Have you tried automating outlook from VB? This, I would say, is the best option. As you have outlook installed on the machine, you can automate outlook and access all the information you want.

Here is a sample code that adds the first names of all the people in my outlook contacts.

    Dim objOutlook As New Outlook.Application
    Dim objFolder As Outlook.MAPIFolder
    Dim objItem As Outlook.ContactItem
    Dim objNameSpace As Outlook.NameSpace
    Dim i As Integer
   
    Set objNameSpace = objOutlook.GetNamespace("MAPI")
    Set objFolder = objNameSpace.GetDefaultFolder _(olFolderContacts)
   
    For i = 1 To objFolder.Items.Count
        List1.AddItem objFolder.Items(i).FirstName
    Next
   
    objOutlook.Quit

It is that simple. You can list any of the properties instead of first name. This is the easiest way.

Hope it helps.

Regards
Madhur
0
 
hmadhurCommented:
Set objFolder = objNameSpace.GetDefaultFolder _(olFolderContacts)

Dont put the underscore before the brackets. It was a typing mistake  :~)

Madhur
0
 
DanAvniCommented:
Note that outlook has a security warning displayed when you try to access contact information (this applies to all versions of outlook since outlook 2000 with some SP and above). to overcome this you need to access the contacts through extended MAPI which is only available in C++.

we have studied this very hard and deep and found that you can use outlook redemption (http://www.dimastr.com/redemption/) as a good MAPI object that will override the security warning
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
CleanupPingCommented:
Hi maryam1359,
This old question (QID 20554439) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
GPrentice00Commented:
This question has been classified as abandoned.  I will make a recommendation to the moderators on its resolution in a week or two.  I would appreciate any comments by the experts that would help me in making a recommendation.
It is assumed that any participant not responding to this request is no longer interested in its final deposition.

If the asker does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp

GPrentice00
Cleanup Volunteer
0
 
GPrentice00Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

 -->Split between hmadhur and DanAvni

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now