Once you get the search folder reference it's just another folder with an
Items collection. You'd iterate the Items collection as you would with any
other folder.
If you create a search folder yourself in code you can get the MAPIFolder
reference passed by the Save() function and get the folder EntryID and use
that later to get the folder using NameSpace.GetFolderFromID(). After that
you work with the Items collection.
I'm not sure what your code is trying to do other than using non-existent
properties from Redemption. There is no RDOStore.Searches property or
collection to work with, I'm not sure where you came up with that.
Code like this will get you to the search root folder, from there you
iterate the folders collection of the search root:
Dim SearchRoot As Redemption.RDOFolder
Set SearchRoot = Session.Stores.DefaultStore.SearchRootFolder
Set Search = SearchRoot.Folders.Item("Current Sent & Received")
Set searchItems = Search.Items ' RDOItems
Then just iterate the items collection.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"McKilty" <***@gmail.com> wrote in message news:386b85b7-5560-4736-86cc-***@g31g2000yqc.googlegroups.com...
On Sep 29, 5:01 pm, McKilty <***@gmail.com> wrote:
<snip>
I'm afraid I need more help. So, again, what we want to do is all all
the Sent & Received items for the previous day. Then we record the
From, To, CC, Subject, and first 100 characters in a spreadsheet.
Using Dmitry's code, I was able to find the folder, but I don't know
how to access the items in it.
1 - Can I set a Collections to the search folder so I can then filter
as normal?
I realize that I could also create a search folder on the fly for the
previous day rather than filter, but still, I need to know how to
access the e-mails and pull the info.
Here is my code so far:
-------------------------------------------------------------------------------------------
Dim iMailItem As Integer
Dim dteStart As String
Dim dteEnd As String
Dim myOutlook As Outlook.Application
Dim myNameSpace As Namespace
Dim mItemCollection As Items
Dim myMailItem As MailItem
'Dim myEmail As Outlook.MailItem
Dim SafeMail
Dim sUser As String
Dim sMailbox As String
Dim sFolder As String
Dim sSaveLocation As String
Dim Session
Dim Search
Dim Searches
Dim SRFolder
'On Error GoTo ErrorHandler
'U S E R V A R I A B L E S
''Rick Bray
******************************************************************
sUser = "rbray"
sMailbox = "Mailbox - Bray, Rick"
dteStart = (Date - 1 & " 00:00")
dteEnd = (Date - 1 & " 23:59")
Set myOutlook = CreateObject("Outlook.Application")
Set myNameSpace = myOutlook.GetNamespace("MAPI")
Set Session = CreateObject("Redemption.RDOSession")
Session.Logon
Set Searches = Session.Stores.DefaultStore.Searches
For i = 1 To Searches.Count
Set Search = Searches.Item(i)
If Search.Name = "Current Sent & Received" Then
Exit For
End If
Next
'I don't know what this line does or what I can/should do with it.
SRFolder = Search.GetFolder(True)
' This next section is from my existing code.
' I'd like to set mItemCollection to SRFolder, or the contents of
Search, but I can't figure that out.
Set mItemCollection = myNameSpace.Folders(sMailbox).Folders("Search
Folders").Folders("Current Sent & Received")
'Set Filter to previous day
Set mItemCollection = mItemCollection.Restrict("[SentOn] >= '" &
dteStart & "'")
Set mItemCollection = mItemCollection.Restrict("[SentOn] <= '" &
dteEnd & "'")
mItemCollection.Sort "[SentOn]", False
For iMailItem = 1 To mItemCollection.Count
Set myMailItem = mItemCollection.Item(iMailItem)
Set SafeMail = CreateObject("Redemption.SafeMailItem")
SafeMail.Item = myMailItem
sSender = SafeMail.SenderName
sSentTo = SafeMail.To
etc.
-------------------------------------------------------------------------------------------
Thanks for your help.