Share via


SearchFolders Interface

A collection of ScopeFolder objects that determines which folders are searched when the Execute method of the FileSearch object is called.

Namespace:  Microsoft.Office.Core
Assembly:  office (in office.dll)

Syntax

'Declaration
<GuidAttribute("000C036A-0000-0000-C000-000000000046")> _
Public Interface SearchFolders _
    Inherits _IMsoDispObj, IEnumerable
'Usage
Dim instance As SearchFolders
[GuidAttribute("000C036A-0000-0000-C000-000000000046")]
public interface SearchFolders : _IMsoDispObj, 
    IEnumerable

Remarks

Use the SearchFolders property with the FileSearch object to return the SearchFolders collection.

For each application there is only a single SearchFolders collection. The content of the collection remains after the code that calls it has finished executing. Consequently, it is important to clear the collection unless you want to include folders from previous searches in your search.

You can use the Add method of the SearchFolders collection to add a ScopeFolder object to the SearchFolders collection; however, it is usually simpler to use the AddToSearchFolders method of the ScopeFolder that you want to add, as there is only one SearchFolders collection for all searches.

The SearchFolders collection can be seen as a compliment to the LookIn property of the FileSearch object. Both specify the folders to search and both are used when the search is executed. However, if you only want to use the LookIn property, you should make sure that the SearchFolders collection is empty. Conversely, if you only want to use the SearchFolders collection, set the LookIn property to the path of the first member of the SearchFolders collection before you call the Execute method.

See Also

Reference

SearchFolders Members

Microsoft.Office.Core Namespace