b***@gmail.com
2014-08-05 19:01:30 UTC
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
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