RDOSearches object

 

RDOSearches collection represents search folders visible in the Outlook UI under "Search Folders" node in the Folder List pane in Outlook.

Note that a raw MAPI search folder (exposed by the RDOSearchFolder Redemption object) is not normally visible in the Search Folders node in Outlook.

Both template based ("Large Messages", "Unread Mail", etc) and custom search folders are supported.

 

Returned by:

RDOStore2.Searches

 

The example below creates 2 search folders: one that displays all messages larger than 1 Mb and another that shows all received messages that have the word "Redemption" in its subject or body.

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Store = Session.Stores.DefaultStore
set Searches = Store.Searches

 

'Add a search folder that shows messages larger than 1MB.

set NewSearch = Searches.AddLargeMessages("Huge Messages", 1048576) ' > 1MB

 

'Add a search folder that shows all received messages with the word "Redemption" in the message body or subject.

strSQL = "(Body LIKE '%Redemption%') OR (Subject LIKE '%Redemption%') "
set Folder = Store.IPMRootFolder
Dim ExcludedFolders(6)
ExcludedFolders(0) = olFolderSentMail
ExcludedFolders(1) = olFolderDeletedItems
ExcludedFolders(2) = olFolderJunk
ExcludedFolders(3) = olFolderConflicts
ExcludedFolders(4) = olFolderLocalFailures
ExcludedFolders(5) = olFolderSyncIssues
ExcludedFolders(6) = olFolderOutbox
set NewSearch = Searches.AddCustom("All Redemption messages", strSQL, Folder, true, ExcludedFolders)

 

Properties

Methods

 


Derived from: IDispatch


Properties


Count

integer, read-only. Specifies the number of items in the collection.

 

 

Methods


AddCategorized(Name, Categories)

Adds and returns a search folder (RDOSearch) that displays messages with a category.

 

Name - string. The name of the search folder.

 

Categories - optional, string. If not specified, messages with any category will bee displayed. If specified, either a single category (e.g. "Business") or a ";" separated list of categories (e.g. "Business;Holiday").

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Store = Session.Stores.DefaultStore
set Searches = Store.Searches

set NewSearch = Searches.AddCategorized("Messages with any category")
set NewSearch = Searches.AddCategorized("Messages with a given category", "test 1")
set NewSearch = Searches.AddCategorized("Messages with multiple categories", "Business;Holiday")

 

AddConversations(Name, AddressEntryOrArrayOfAddressEntires)

 

Adds and returns a search folder (RDOSearch) that displays messages from and to the specified people.

 

Name - string. The name of the search folder.

 

AddressEntryOrArrayOfAddressEntires - either an RDOAddressEntry or an array of RDOAddressEntryobjects.

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Store = Session.Stores.DefaultStore
set Searches = Store.Searches

 

set AddressEntry = Session.AddressBook.ResolveName("Smith, John")

set NewSearch = Searches.AddConversations("Messages to/from John Smith", AddressEntry )

 

dim AddressEntries(1)
set AddressEntries(0) = Session.AddressBook.ResolveName("Jack")
set AddressEntries(1) = Session.AddressBook.ResolveName("John")
set NewSearch = Searches.AddConversations("Messages to/from Jack or John", AddressEntries)

 

AddCustom(Name, SQLQuery, StartFolder, Recursive, ExcludedFoldersArray)

 

Adds and returns a search folder (RDOSearch) with a custom search criteria.

 

Name - string. The name of the search folder.

 

SQLQuery - string. Search criteria as a SQL string. Can be either a full SQL expression with both SELECT and WHERE clauses or just the WHERE clause without the WHERE keyword.

 

FolderOrArrayOfFolders - either RDOFolder object or an array of the RDOFolder objects, optional.

Specifies the folder(s) where the search will be performed. If not specified, the root IPM folder (the top visible folder) will be used.

 

Recursive - boolean, optional. Specifies whether the search will include the child subfolders (if true) or only run in the specified folder(s) (if false).

Defaults to TRUE if not specified.

 

ExcludedFoldersArray - Optional. An array of either integers (rdoDefaultFolders enums), strings (assumed to be folder entry ids), or RDOFolder objects.

.

If not specified, the following folders are excluded:

olFolderDeletedItems, olFolderJunk, olFolderConflicts, olFolderLocalFailures, olFolderSyncIssues, olFolderOutbox.

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Store = Session.Stores.DefaultStore
set Searches = Store.Searches

 

'Add a search folder that displays messages from the Sent Items and Drafts folders

'sent using accounts with "dimastr.com" in their names.

strSQL = """http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8580001F"" LIKE '%dimastr.com%' "
Dim Folders(1)
set Folders(0) = Store.GetDefaultFolder(olFolderSentMail)
set Folders(1) = Store.GetDefaultFolder(olFolderDrafts)
set NewSearch = Searches.AddCustom("Sent by dimastr.com account", strSQL, Folders, false)

 

'Add a search folder that shows all received messages with the word "Redemption" in the message body or subject.

strSQL = "(Body LIKE '%Redemption%') OR (Subject LIKE '%Redemption%') "
set Folder = Store.IPMRootFolder
Dim ExcludedFolders(6)
ExcludedFolders(0) = olFolderSentMail
ExcludedFolders(1) = olFolderDeletedItems
ExcludedFolders(2) = olFolderJunk
ExcludedFolders(3) = olFolderConflicts
ExcludedFolders(4) = olFolderLocalFailures
ExcludedFolders(5) = olFolderSyncIssues
ExcludedFolders(6) = olFolderOutbox
set NewSearch = Searches.AddCustom("All Redemption messages", strSQL, Folder, true, ExcludedFolders)

 

AddFromSpecificPerson(Name, AddressEntryOrArrayOfAddressEntires)

Adds and returns a search folder (RDOSearch) that displays messages from the specified people.

 

Name - string. The name of the search folder.

 

AddressEntryOrArrayOfAddressEntires - either an RDOAddressEntry or an array of RDOAddressEntryobjects.

 

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Store = Session.Stores.DefaultStore
set Searches = Store.Searches

 

set AddressEntry = Session.AddressBook.ResolveName("Smith, John")

set NewSearch = Searches.AddFromSpecificPerson("Messages from John Smith", AddressEntry )

 

dim AddressEntries(1)
set AddressEntries(0) = Session.AddressBook.ResolveName("Jack")
set AddressEntries(1) = Session.AddressBook.ResolveName("John")
set NewSearch = Searches.AddFromSpecificPerson("Messages from Jack or John", AddressEntries)

 

AddImportantMail(Name)

Adds and returns a search folder (RDOSearch) that displays messages with high importance.

 

Name - string. The name of the search folder.

 

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Store = Session.Stores.DefaultStore
set Searches = Store.Searches

set NewSearch = Searches.AddImportantMail("Very Important Messages")

 

AddLargeMessages(Name, Size)

Adds and returns a search folder (RDOSearch) that displays messages larger than the specified value.

 

Name - string. The name of the search folder.

 

Size - integer. Message size, in bytes.

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Store = Session.Stores.DefaultStore
set Searches = Store.Searches

set NewSearch = Searches.AddLargeMessages("Huge Messages", 1048576) ' > 1MB

 

AddMarkedForFollowup(Name)

Adds and returns a search folder (RDOSearch) that displays messages marked for follow-up.

 

Name - string. The name of the search folder.

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Store = Session.Stores.DefaultStore
set Searches = Store.Searches

set NewSearch = Searches.AddMarkedForFollowup("Marked for followup")

 

AddSentDirectlyToMe(Name)

 

Adds and returns a search folder (RDOSearch) that displays messages sent directly to the current user.

 

Name - string. The name of the search folder.

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Store = Session.Stores.DefaultStore
set Searches = Store.Searches

set NewSearch = Searches.AddSentDirectlyToMe("Seent To Me only")

 

AddSentToSpecificDistributionList(Name, AddressEntryOrArrayOfAddressEntires)

Adds and returns a search folder (RDOSearch) that displays messages sent to the specified recipients.

 

Name - string. The name of the search folder.

 

AddressEntryOrArrayOfAddressEntires - either an RDOAddressEntry or an array of RDOAddressEntryobjects.

 

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Store = Session.Stores.DefaultStore
set Searches = Store.Searches

 

set AE = Session.AddressBook.ResolveName("List 1")
set NewSearch = Searches.AddSentToSpecificDistributionList("Sent to " & AE.Name, AE)

dim AddressEntries(1)
set AddressEntries(0) = Session.AddressBook.ResolveName("List 1")
set AddressEntries(1) = Session.AddressBook.ResolveName("List 2")
set NewSearch = Searches.AddSentToSpecificDistributionList("Sent to 2 lists", AddressEntries)
 

AddOldMail(Name, TimeSpec, Value)

Adds and returns a search folder (RDOSearch) that displays messages older than the specified value.

 

Name - string. The name of the search folder.

 

TimeSpec - one of the rdoTimePeriod enums:

tpDay = 0
tpWeek = 1
tpMonth = 2

 

Value - integer. The number of units determined by the TimeSpec parameter.

 

tpMonth = 2

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Store = Session.Stores.DefaultStore
set Searches = Store.Searches

set NewSearch = Searches.AddOldMail("3 Moths Old Messages", tpMonth, 3)

 

 

AddUnreadMessages(Name)

 

Adds and returns a search folder (RDOSearch) that displays unread messages.

 

Name - string. The name of the search folder.

 

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

set Store = Session.Stores.DefaultStore
set Searches = Store.Searches

set NewSearch = Searches.AddUnreadMessages("Unread messages")

 

AddUnreadOrMarkedForFollowup(Name)

 

Adds and returns a search folder (RDOSearch) that displays messages that are either unread or marked for follow-up.

 

Name - string. The name of the search folder.

 

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

set Store = Session.Stores.DefaultStore
set Searches = Store.Searches

set NewSearch = Searches.AddUnreadOrMarkedForFollowup("Unread or marked for followup")

 

AddWithAttachments(Name)

Adds and returns a search folder (RDOSearch) that displays messages with attachments.

 

Name - string. The name of the search folder.

 

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

set Store = Session.Stores.DefaultStore
set Searches = Store.Searches

set NewSearch = Searches.AddWithAttachments("Messages with attachments")

 

AddWithSpecificWords(Name, Words)

Adds and returns a search folder (RDOSearch) that displays messages with attachments.

 

Name - string. The name of the search folder.

 

Words - string. A single word or a ";" separated list of words.

 

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

set Store = Session.Stores.DefaultStore
set Searches = Store.Searches

set NewSearch = Searches.AddWithSpecificWords("Messages with specific words", "OutlookSpy;Redemption")

Item(Index)

Returns a search folder (RDOSearch) with the specified index

 

Index - integer. 1 through Count.

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Searches = Session.Stores.DefaultStore.Searches
for i = 1 to Searches.Count
    set Search = Searches.Item(i)
    Debug.Print Search.Name & ": " & Search.SearchCriteria.AsSQL
next