CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2001
    Location
    Portugal
    Posts
    26

    URGENT: ADRESS LIST

    I have a combo box where i want the user to select a name address in my global adress list.

    How can i get all the names of my address list to add it in the combo?

    I already look for this, but only get information of displaing folders, messages, and x validations...

    tks
    JP- I rate all the help


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: URGENT: ADRESS LIST

    What is global address list? Is it a list box or what?

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Feb 2001
    Posts
    54

    Re: URGENT: ADRESS LIST

    Hello:

    If I understand you correctly, what you can do is put global addresses into a database and use ADO to get information from Combo:

    Do Until Adodc1.Recordset.EOF


    Combo1.AddItem (Adodc1.Recordset.Fields(1).Value)
    Adodc1.Recordset.MoveNext
    Loop

    Good Luck



  4. #4
    Join Date
    Apr 2001
    Location
    Portugal
    Posts
    26

    Re: URGENT: ADRESS LIST

    No. I really want to get all names in my Outlook Global Adress List.


  5. #5
    Join Date
    Apr 2001
    Location
    Portugal
    Posts
    26

    Re: URGENT: ADRESS LIST

    No Iouri. I really want to get all the names in my Outlook Global Adress List and put him in a combo box. I just dont know how can i do this.


  6. #6
    Join Date
    Jun 2001
    Location
    Germany
    Posts
    3

    Re: URGENT: ADRESS LIST

    hello,

    u should user the Microsoft Outlook Object Library.

    Dim myNameSpace As Outlook.NameSpace
    Set myNameSpace = Application.GetNameSpace("MAPI")
    Dim myGAddressList as Outlook.AddressList
    Set myGAddressList = myNameSpace.AddressLists _("Global Address List")
    Dim myAddressEntries As Outlook.AdressEntries
    Set myAddressEntries= myAddressList.AddressEntries
    For i=1 to myAddressEntries.Count
    Combo1.AddItem (myAddressEntries.Item(i).Name)
    Next i

    Perhaps it will helo u.

    Jens-Uwe


  7. #7
    Join Date
    Apr 2001
    Location
    Portugal
    Posts
    26

    Re: URGENT: ADRESS LIST

    Tks Jens-Uwe,

    Was a nice tip, however i had to create a application object. Worked like this:

    Dim myOlapp As Outlook.Application
    Dim myNameSpace As Outlook.NameSpace
    Dim myGAddressList As Outlook.AddressList
    Dim myGAddressEntries As Outlook.AddressEntries
    Set myOlapp = CreateObject("Outlook.Application")
    Set myNameSpace = myOlapp.GetNamespace("MAPI")
    Set myGAddressList = myNameSpace.AddressLists("Global Address List")
    Set myGAddressEntries = myGAddressList.AddressEntries
    For i = 1 To myGAddressEntries.Count
    cmbEmail.AddItem (myGAddressEntries.Item(i).Name)
    Next i

    Tks again.
    JP- I rate your help




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured