RDOSearchContainersList object

 

RDOSearchContainersList object represents the list of folders where the search is performed by the RDOSearchFolder object. All changes made to this object are only applied after RDOSearchFolder.Start method is called.

On the Extended MAPI level, this collection corresponds to the list returned by the IMAPIFolder::GetSearchCriteria method.

 

Returned by:

RDOSearchFolder.SearchContainers

RDOSearch.SearchContainers

 

The example below logs to the default MAPI session and creates a new search folder that contains messages with the "test" substring in the subject property. The search is performed in the Inbox and Sent Items folders.

Note that you will need to wait until RDOSearchFolder.IsRebuild property (see below) becomes false, meaning that Outlook finished searching through the specified folders.

Also note that the newly created folder will not be displayed as one of the "Search Folders" subfolders in Outlook 2003. Use RDOSearches and RDOSearch objects for that. .

RES_CONTENT = 3
FL_SUBSTRING = 1
FL_IGNORECASE = &H10000
PR_SUBJECT = &H0037001E
'create new search folder
set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set DefaultStore = Session.Stores.DefaultStore
set SearchRootFolder = DefaultStore.SearchRootFolder
set NewSearchFolder = SearchRootFolder.Folders.AddSearchFolder("Test Redemption Search Folder")
'set the restriction to search for message with the word "test" in the subject line
set Restriction = NewSearchFolder.SearchCriteria.SetKind(RES_CONTENT)
Restriction.ulFuzzyLevel = FL_SUBSTRING or FL_IGNORECASE
Restriction.ulPropTag = PR_SUBJECT
Restriction.lpProp = "test"
'specify that the search should be performed in the Inbox and Sent Items folders
NewSearchFolder.SearchContainers.Add(DefaultStore.GetDefaultFolder(olFolderInbox))
NewSearchFolder.SearchContainers.Add(DefaultStore.GetDefaultFolder(olFolderSentMail))

'specify the search flags
NewSearchFolder.IsRecursiveSearch = false
NewSearchFolder.IsForegroundSearch = false
'we are all set: set the search parameters and let the fun begin!
NewSearchFolder.Start


Derived from: IDispatch



Properties


Count

integer, read-only. Returns the number of folders in the list

 

_Item(Index)

returns RDOFolder object with a given index. Default object property.

Index - integer, 1 through Count.

 


Methods


Add(FolderOrEntryID)

Adds a folder to the list of containers used by the search folder. The folder must belong to the same message store as search folder's parent store.

FolderOrEntryID - variant. Either an RDOFolder object or a string representing the folder entry id.

see above

Item(Index)

returns RDOFolder object with a given index.

Index - integer, 1 through Count.

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set SearchRootFolder = Session.Stores.DefaultStore.SearchRootFolder
for i = 1 to SearchRootFolder.Folders.Count
  set Folder = SearchRootFolder.Folders.Item(i)
  Debug.Print "Search containers for folder: " & Folder.Name
  for j = 1 to Folder.SearchContainers.Count
    set ContainerFolder = Folder.SearchContainers.Item(j)
    Debug.Print ContainerFolder.Name
  next
  Debug.Print "------- "
next

Remove(Index)

Removes a folder with a given index from the list of containers used by the search folder.

Index - integer, 1 through Count.