|
-
Sep 27th, 2000, 04:53 AM
#1
Thread Starter
Lively Member
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.
-
Sep 27th, 2000, 05:15 AM
#2
Member
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
-
Sep 27th, 2000, 05:25 AM
#3
Member
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
-
Sep 27th, 2000, 05:56 AM
#4
_______
<?>
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
-
Sep 27th, 2000, 06:01 AM
#5
_______
<?>
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
-
Sep 27th, 2000, 06:23 AM
#6
Member
Dummy
HeSaidJoe,
I am slow !!
What did you change to get the EMailAddress aswell.
Thanks Bob.
-
Sep 27th, 2000, 06:32 AM
#7
Thread Starter
Lively Member
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.
-
Sep 27th, 2000, 06:50 AM
#8
Member
Thanks
Anakim,
Excellent
Thanks for your patients.....Bob
-
Jul 23rd, 2001, 08:41 AM
#9
Lively Member
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?
-
Jul 23rd, 2001, 03:45 PM
#10
Thread Starter
Lively Member
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.
-
Jul 24th, 2001, 03:24 AM
#11
Lively Member
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
-
Jul 24th, 2001, 04:06 AM
#12
Thread Starter
Lively Member
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.
-
Jul 26th, 2001, 03:29 AM
#13
Lively Member
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
-
Jul 26th, 2001, 07:14 AM
#14
Thread Starter
Lively Member
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.
-
Jul 26th, 2001, 07:53 AM
#15
Lively Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|