Assembly: office (in office.dll)
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.