I am trying to populate a listbox with data from an outlook sent items folder, the code is as follows:
Dim olApp As Outlook.Application
Dim nsNameSpace As Outlook.NameSpace
Dim fldFolder As Outlook.MAPIFolder
Dim objMessages As Object
Dim strData As String
Set olApp = New Outlook.Application
Set nsNameSpace = olApp.GetNamespace("MAPI")
Set fldFolder = nsNameSpace.GetDefaultFolder(olFolderSentMail)
Set objMessages = fldFolder.Items
For Each objMessage In objMessages
strData = strData & "'" & objMessage.Recipients & "',"
Next objMessage
List6.RowSource = strData
I thought this should list all the recipients email addresses, but it returns an error. If I replace the Recipients with Subject, it works fine, so I am guessing I am using a wrong property. I have searched everywhere for a list of the properties for this object but I can't seem to find anything anywhere that makes sense. I would also like to do this similar thing with the olFolderInbox and have all sender email addresses populate a listbox...
Dim olApp As Outlook.Application
Dim nsNameSpace As Outlook.NameSpace
Dim fldFolder As Outlook.MAPIFolder
Dim objMessages As Object
Dim strData As String
Set olApp = New Outlook.Application
Set nsNameSpace = olApp.GetNamespace("MAPI")
Set fldFolder = nsNameSpace.GetDefaultFolder(olFolderSentMail)
Set objMessages = fldFolder.Items
For Each objMessage In objMessages
strData = strData & "'" & objMessage.Recipients & "',"
Next objMessage
List6.RowSource = strData
I thought this should list all the recipients email addresses, but it returns an error. If I replace the Recipients with Subject, it works fine, so I am guessing I am using a wrong property. I have searched everywhere for a list of the properties for this object but I can't seem to find anything anywhere that makes sense. I would also like to do this similar thing with the olFolderInbox and have all sender email addresses populate a listbox...