VB6 - Look up email address from outlook address book?

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: VB6 - Look up email address from outlook address book?

 
0
  #11
Jul 26th, 2007
Hi tgif,

use this code:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim TItem As ListItem
  2. If lvw.SelectedItem.text <> "" Then
  3. Set TItem = lvw.SelectedItem
  4. EMailID=TItem.SubItems(2)
  5. Else
  6. MsgBox "No Item Selected From list"
  7. End If

Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 113
Reputation: tgifgemini is an unknown quantity at this point 
Solved Threads: 0
tgifgemini tgifgemini is offline Offline
Junior Poster

Re: VB6 - Look up email address from outlook address book?

 
0
  #12
Jul 26th, 2007
Good morning Veena.
Thanks for your numerous contributions. I put the codes below inside my form load() module, because I want the listview control to get populated on form load then I can select and email from the list then click the sendEmail button.
However, when I tried to compile, I get Error msg: Run-Time error 380 -Invalid property value:

This line of code generates the error:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. lvw.ListItems(lvw.ListItems.Count).SubItems(1) = OutlookAddressEntry.Address

Below is my form load module:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Form_Load()
  2.  
  3. Set OutlookApp = New Outlook.Application
  4. Set OutlookMailItem = OutlookApp.CreateItem(olMailItem)
  5. Set OutlookNameSpace = OutlookApp.GetNamespace("MAPI")
  6.  
  7.  
  8. For Each OutlookAddressList In OutlookNameSpace.AddressLists
  9. For Each OutlookAddressEntry In OutlookAddressList.AddressEntries
  10. lvw.ListItems.Add , , OutlookAddressEntry.Name
  11. lvw.ListItems(lvw.ListItems.Count).SubItems(1) = OutlookAddressEntry.Address
  12. lvw.ListItems(lvw.ListItems.Count).SubItems(2) = OutlookAddressEntry.ID
  13. lvw.ListItems(lvw.ListItems.Count).Tag = OutlookAddressEntry.ID
  14. Next
  15. Next
  16. End Sub
Thanks,
tgifgemini
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: VB6 - Look up email address from outlook address book?

 
0
  #13
Jul 27th, 2007
Hi,

Just change the code:
Set lvw.ReportType = lvwReport

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim X As ListItem
  2.  
  3. Set OutlookApp = New Outlook.Application
  4. Set OutlookMailItem = OutlookApp.CreateItem(olMailItem)
  5. Set OutlookNameSpace = OutlookApp.GetNamespace("MAPI")
  6.  
  7.  
  8. For Each OutlookAddressList In OutlookNameSpace.AddressLists
  9. For Each OutlookAddressEntry In OutlookAddressList.AddressEntries
  10. set X= lvw.ListItems.Add( , , OutlookAddressEntry.Name)
  11. X.SubItems(1) = OutlookAddressEntry.Address
  12. X.SubItems(2) = OutlookAddressEntry.ID
  13. X.Tag = OutlookAddressEntry.ID
  14. Next
  15. Next

Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 113
Reputation: tgifgemini is an unknown quantity at this point 
Solved Threads: 0
tgifgemini tgifgemini is offline Offline
Junior Poster

Re: VB6 - Look up email address from outlook address book?

 
0
  #14
Jul 27th, 2007
Good morning Veena,
how are you doing today? I really do appreciate all your assistance. I plugged in recent code you you gave me and I am getting same "RunTime error 380 - Invalid property value". I am going nuts with this Microsoft stuff that is not telling you what the actual problem is.
And I don't know where else to look.

Thanks.
tgifgemini
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 113
Reputation: tgifgemini is an unknown quantity at this point 
Solved Threads: 0
tgifgemini tgifgemini is offline Offline
Junior Poster

Re: VB6 - Look up email address from outlook address book?

 
0
  #15
Jul 27th, 2007
Good morning Veena,
how are you doing today? I really do appreciate all your assistance. I plugged in recent code you you gave me and I am getting same "RunTime error 380 - Invalid property value" on this line of code:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. x.subItems(1) = OutlookAddressEntry.Address
and a compile error: "Method or Data member not found" on this line: [Set lvw.ReportType = lvwReport[/code]I am going nuts with this Microsoft stuff that is not telling you what the actual problem is.
And I don't know where else to look.

Question: Shouldn't I first Dimension "lvw" as something before the 'set lvw.ReportType = lvwReport' statement?

Thanks.
tgifgemini
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 113
Reputation: tgifgemini is an unknown quantity at this point 
Solved Threads: 0
tgifgemini tgifgemini is offline Offline
Junior Poster

Re: VB6 - Look up email address from outlook address book?

 
0
  #16
Jul 27th, 2007
Veena,
Actually, I went ahead and created ListView header columns which I didn't have initially, therefore since I want to display 3 items in the columns, it didn't find any columns to append the items.

This is what I did:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. 'create columns
  2. lvw.ColumnHeaders.Clear
  3. lvw.ColumnHeaders.Add , ,"Address"
  4. lvw.ColumnHeaders.Add , ,"ID"

And it populated the ListView with the the physical names "gift, xtian" etc.
So I used the first subscript(1) as the address and it worked like magic.
Thanks.
You're a true trooper for holding my hand all along.
tgifgemini.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: VB6 - Look up email address from outlook address book?

 
0
  #17
Jul 28th, 2007
Hi,

OK, its:

lvw.view=3

And u have to add column headers..
Write this code b4 populating the list..

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim lvwColumn As ColumnHeader
  2.  
  3. lvwColumn = New ColumnHeader()
  4. lvwColumn.Text = "Name"
  5. lvw.Columns.Add(lvwColumn)
  6.  
  7. lvwColumn = New ColumnHeader()
  8. lvwColumn.Text = "Address"
  9. lvw.Columns.Add(lvwColumn)
  10.  
  11. lvwColumn = New ColumnHeader()
  12. lvwColumn.Text = "ID"
  13. lvw.Columns.Add(lvwColumn)

Sorry for the inconvinience..

Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 166
Reputation: AV Manoharan is an unknown quantity at this point 
Solved Threads: 9
AV Manoharan AV Manoharan is offline Offline
Junior Poster

Re: VB6 - Look up email address from outlook address book?

 
0
  #18
Jul 28th, 2007
Hello All.

You people are waisting your time and energy. And I can't understand, why people gives in this thread so many type of codes, telling one way or the other I am soory, please change to this, please omit that etc. without first understanding the basic of it or trying the code themselves! If you have heeded to my advice in this forum by telling gemini that the answer is NO as well as Yes.

I will put it briefly below. Think about it and answer me.

First of all, if you are thinking Outlook Express, just forget it. The only three ways of integrating with Outlook Express are (and this is just my guessing) by paying Microsoft a lot of money and by giving them a really good reason to why you want to do that, or by hooking in through the encryption-entry, or by creating a proper hook and hacking your way in there.

Could you make out any thing from the bold entries above?

Happy Programming

AV Manoharan




Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 113
Reputation: tgifgemini is an unknown quantity at this point 
Solved Threads: 0
tgifgemini tgifgemini is offline Offline
Junior Poster

Re: VB6 - Look up email address from outlook address book?

 
0
  #19
Jul 30th, 2007
Hi AV Manoharan,
I don't know what you are babbling about, but Veena have correctly answered my question, so be cool.
tgifgemini.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 166
Reputation: AV Manoharan is an unknown quantity at this point 
Solved Threads: 9
AV Manoharan AV Manoharan is offline Offline
Junior Poster

Re: VB6 - Look up email address from outlook address book?

 
0
  #20
Jul 31st, 2007
Originally Posted by tgifgemini View Post
Hi AV Manoharan,
I don't know what you are babbling about, but Veena have correctly answered my question, so be cool.
tgifgemini.
Correctly answered what? Getting email address from the outlook express? The email addresses stored in the outlook express are encrypted ! and you and Veena Could hack it and decrypt it. Fantastic Dear.


regards
AV Manoharan
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC