Discussion:
Displaying the Address Book
(too old to reply)
b***@gmail.com
2014-08-05 19:01:30 UTC
Permalink
I have an application for which I need to open the Outlook address book, allow the user to specify To, CC, and BCC, and when the close the address book, it will put the email addresses for To, CC, and BCC in the applicable fields on my form.

This part I have working, however if they click the button again, I want the address book to be pre-populated with what already exists on the form. I do not know how to do this.

It fails when I try to add a recipient.

I am programming in Visual Basic and would prefer a solution in the same.


Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click

Dim session As RDOSession
Dim ab As RDOAddressBook
Dim recips As RDORecipients
Dim iToCount As Integer
Dim iCcCount As Integer
Dim iBccCount As Integer

Session = CreateObject("Redemption.RDOSession")
Session.Logon()

recips.Add("***@domain.net") <---- FAILS HERE

AB = Session.AddressBook
Recips = AB.ShowAddressBook("Choose your Recipients", False, False)

Dim iAddress As Integer
For iAddress = 1 To Recips.Count
Select Case Recips.Item(iAddress).Type
Case 1
iToCount = iToCount + 1
If iToCount > 1 Then
Me.txtTo.Text &= "; "
End If
Me.txtTo.Text &= Recips.Item(iAddress).AddressEntry.SMTPAddress

Case 2
iCCCount = iCCCount + 1
If iCCCount > 1 Then
Me.txtCc.Text &= "; "
End If
Me.txtCc.Text &= Recips.Item(iAddress).AddressEntry.SMTPAddress

Case 3
iBCCCount = iBCCCount + 1
If iBCCCount > 1 Then
Me.txtBcc.Text &= "; "
End If
Me.txtBcc.Text &= Recips.Item(iAddress).AddressEntry.SMTPAddress

End Select
Next


End Sub
b***@gmail.com
2014-08-06 13:05:04 UTC
Permalink
I solved this morning. I had to get recips from a message, but I had had a lot of trouble earlier. I think this morning I discovered RDOMail and that enabled me to get to a solution.


Private Sub cmdSelectRecipients_Click(sender As Object, e As EventArgs) Handles cmdSelectRecipients.Click

Dim session As RDOSession
Dim ab As RDOAddressBook
Dim recips As RDORecipients

Dim iToCount As Integer
Dim iCcCount As Integer
Dim iBccCount As Integer

Dim myMsg As RDOMail

session = CreateObject("Redemption.RDOSession")
session.Logon()

myMsg = session.GetDefaultFolder(rdoDefaultFolders.olFolderOutbox).Items.Add("IPM.Note")
myMsg.Recipients.Add("***@email.com")

ab = session.AddressBook

recips = ab.ShowAddressBook(myMsg.Recipients, "Choose your Recipients", False, False)



Dim iAddress As Integer
For iAddress = 1 To recips.Count
Select Case recips.Item(iAddress).Type
Case 1
iToCount = iToCount + 1
If iToCount > 1 Then
Me.txtTo.Text &= "; "
End If
Me.txtTo.Text &= recips.Item(iAddress).AddressEntry.SMTPAddress

Case 2
iCcCount = iCcCount + 1
If iCcCount > 1 Then
Me.txtCc.Text &= "; "
End If
Me.txtCc.Text &= recips.Item(iAddress).AddressEntry.SMTPAddress

Case 3
iBccCount = iBccCount + 1
If iBccCount > 1 Then
Me.txtBcc.Text &= "; "
End If
Me.txtBcc.Text &= recips.Item(iAddress).AddressEntry.SMTPAddress

End Select
Next


myMsg = Nothing

End Sub

Loading...