Hi, i have been having trouble how to open the 'To' Contacts list(Cc or To) (address book) of a mail message in outlook using vb.net from where the user would be able to select an email address and would be pulled and stored in our database for later use in the application. I have searched on the internet for it and all that i would find is code that would open up the contacts list, which i dont need. i have been having trouble with finding this code. other than that i have this code which actually opens it up, but im not able to store the selected item. if someone could either let me know what to do with the code i have, to get the selected item or show me a different way to come across this problem.
Thank You.
This is the code i have:
Public Shared Function Test1() As String
Dim objSession As Object
''Dim objSession As
Dim objRecipients As Object
Dim strEntryID As String
Dim strStoreID As String
Dim ss As Outlook.Recipient
objSession = CreateObject("MAPI.Session")
objSession.Logon("", "", False, False)
''objRecipients = objSession.addressbook( _
'' Title:="Select Contact Person", _
'' oneaddress:=True, _
'' Forceresolution:=True, _
'' reciplists:=0)
objRecipients = objSession.addressbook
Try
'MsgBox(objRecipients(1), vbOKOnly, "Selected Name")
'' MsgBox(objRecipients, MsgBoxStyle.OKOnly, "Selected Name")
ss = objRecipients(1)
Catch e As Exception
MessageBox.Show(e.Message)
End Try
objSession.Logoff()
objSession = Nothing
objRecipients = Nothing
End Function