Results 1 to 15 of 15

Thread: email address list

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Location
    A caravan park in the Midlands (UK)
    Posts
    101

    Tink dis will work

    Dim moMail As New Outlook.Application
    Dim moAddresses As Outlook.AddressLists

    Set loNameSpace = moMail.GetNamespace("MAPI")
    Set loAddresses = loNameSpace.AddressLists("Global Address List")

    Set loAddressList = loAddresses.AddressEntries
    lstOutlook.Clear

    For liIndx = 1 To loAddressList.Count
    lstOutlook.AddItem loAddressList.Item(liIndx).Name

    Next

    I'm assuming Outlook Express uses the Outlook object library which you'd need to add to your project "Microsoft Outlook 9.0 Object Library". In my app I have a listbox "lstOutlook" which I populate and the user can select from that who will get any mail the app may produce.

    Hope this is what you were after.
    Anakim

    It's a small world but I wouldn't like to paint it.

  2. #2

    Outlook Message

    I don't know how to import the address list, but would it not suffice to open the New Mail Message screen which woul allow the user to then select the names. The message subject and body could be used from your program if necessary.

    Ex.


    Private Sub Form_Load()
    MAPISession1.SignOn
    With MAPIMessages1
    .SessionID = MAPISession1.SessionID
    .Compose
    .MsgSubject = Form1.Caption
    .MsgNoteText = Form1.FontName & " " & Form1.FontSize
    .Send True
    End With
    MAPISession1.SignOff

    End Sub


    Bob


  3. #3
    Ignore my last effort - pretty pathetic compared to Anakims. Very nifty, but when you work (???) in a place like DELL the global address list can take some time to load. Works excellent with Personal Address Book though.

    Ta very much.

    Bob

  4. #4
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Anakim
    How would you pull the address as well?
    I was trying to make a little app to back up my address
    book and never got it done..this looks ideal if I could
    get the E-MailAddress as well.

    Thanks,
    Wayne
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  5. #5
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Never mind, I got it...duh...used EMailAddress E-MailAddress
    and then Address...works fine...Thanks for the code.
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  6. #6

    Unhappy Dummy

    HeSaidJoe,

    I am slow !!

    What did you change to get the EMailAddress aswell.

    Thanks Bob.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Location
    A caravan park in the Midlands (UK)
    Posts
    101
    Using the code I posted above all you would need to do to get the address is change

    loAddressList.Item(liIndx).Name

    to

    loAddressList.Item(liIndx).address

    Anakim

    It's a small world but I wouldn't like to paint it.

  8. #8

    Smile Thanks

    Anakim,

    Excellent

    Thanks for your patients.....Bob



  9. #9
    Lively Member
    Join Date
    Apr 2001
    Posts
    83

    Unhappy win2k maybe?

    i'm using win2k and i get the error
    "The operation failed, an object could not be found"

    on the line - Set loAddresses = loNameSpace.AddressLists("Global Address List")

    could this be becuase i'm running win2k pro?

    i added the MAPI controls and reference "Microsoft Outlook 6"

    code..
    Dim moMail As New Outlook.Application
    Dim moAddresses As Outlook.AddressLists

    Set loNameSpace = moMail.GetNamespace("MAPI")
    Set loAddresses = loNameSpace.AddressLists("Global Address List")

    Set loAddressList = loAddresses.AddressEntries
    lstOutlook.Clear

    For liIndx = 1 To loAddressList.Count
    lstOutlook.AddItem loAddressList.Item(liIndx).Name

    Next


    any idea's?

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Location
    A caravan park in the Midlands (UK)
    Posts
    101

    Question Outlook 6?

    It's not a win2k issue.... I use Win2k Pro too. I was using the Outlook 9 Object library, and not 6 - which would have a baring on things.

    If you're using 9 then post again and I'll see if I can see what's up. No guarantee's as to when that will be - I'm having far too much fun sorting out some EFT woes (Big tip: Employer looking for employee to assist with credit/debit card authorisations/settlement = employee feels a bad bout of 'flu coming on).
    Anakim

    It's a small world but I wouldn't like to paint it.

  11. #11
    Lively Member
    Join Date
    Apr 2001
    Posts
    83

    Red face Sorry.. typo ;)

    Sorry Anakim, I meant to say 9..
    Microsoft Outlook 9.0 Object Library (Program Files\Microsoft Office\Office\msoutl9.olb)

    Any help that could clarify the situation would be great..

    Sphynx

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Location
    A caravan park in the Midlands (UK)
    Posts
    101

    Have you got a Global Address List?

    Sphynx,

    I think the problem may be down to you not actually having a 'Global Address List'.

    Use the following code to determine what address lists you have set up......
    Code:
    Dim loNameSpace As Outlook.NameSpace
    Dim liIndx      As Integer
    
    For liIndx = 1 To loNameSpace.AddressLists.Count
        Debug.Print loNameSpace.AddressLists.Item(liIndx).Name
    Next
    I think 'Global' would normally be the first available. Hope this helps you out.....



    Anakim
    Anakim

    It's a small world but I wouldn't like to paint it.

  13. #13
    Lively Member
    Join Date
    Apr 2001
    Posts
    83

    Wink Nearly there :)

    Thanks Anakim you've been a great help so far

    I merged the two peices of code to create this:

    -----code----
    On Error Resume Next
    Dim moMail As New Outlook.Application
    Dim moAddresses As Outlook.AddressLists, ppp As Integer, liIndx As Integer
    Set loNameSpace = moMail.GetNamespace("MAPI")
    For liIndx = 1 To loNameSpace.AddressLists.Count
    lstOutlookGetLIST.AddItem loNameSpace.AddressLists.Item(liIndx).Name
    Next
    For ppp = 1 To lstOutlookGetLIST.ListCount
    Set loAddresses = loNameSpace.AddressLists(lstOutlookGetLIST.List(ppp - 1))
    Set loAddressList = loAddresses.AddressEntries
    lstOutlookAddress.Clear

    For liIndx = 1 To loAddressList.Count
    lstOutlookAddress.AddItem loAddressList.Item(liIndx).Address
    Next liIndx
    Next ppp
    -----code----

    Using 2 listboxes (lstOutlookAddress & lstOutlookGetLIST)

    lstOutlookGetLIST is added with all of the AddressLists and then all of the emails from the accounts in lstOutlookGetLIST are retrieved.

    However, to make my email client even more automated, i wanted to retrieve the default accounts SMTP server.

    How would I go about doing this?

    Thankyou,
    Sphynx

  14. #14

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Location
    A caravan park in the Midlands (UK)
    Posts
    101

    Unhappy

    Sorry there Sphynx I can't help you on this one. I've only gone so far as writing applications which e-mail out from the the default exchange account.

    The apps I've written merely sit on a server at work, check the states of various jobs/files etc and e-mails the reports to specified people..... there's never a need to send these from any other account.

    I've written other apps which have 'error reports' embedded, these simply fire off an e-mail detailing the bug/software version etc from the desktop app, using that users account. Again no need to check for differing accounts.

    Post back here if you discover how to do this, I'd be interested to know..... I may have a look myself later if I get some spare (that's a laugh) minutes.


    Anakim
    Anakim

    It's a small world but I wouldn't like to paint it.

  15. #15
    Lively Member
    Join Date
    Apr 2001
    Posts
    83

    Wink just figured it out.. :)

    i just found it..
    quite simple really, it's located in the registry..
    in HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\OMI Account Manager\Accounts\00000001\
    String "SMTP Server"

    or ofcourse 00000002\ or 00000003\ etc depending on which user u want..


    well.. that was easy.. lol just searched the registry for my smtp server.. cool


    Sphynx

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