Search Method
Searches for files and folders matching the query.
Syntax
int Search(char* lpszSearchPath, char* lpszQuery);
Remarks
This method searches for files and folders matching the query at the path specified by SearchPath.
The SearchPath parameter should be the absolute path of the folder to search. The Query parameter should be set to the term for which to search. The search query is split on spaces into multiple tokens. When searching for filenames the last token is used for prefix matching. For instance "bat c" matches "bat cave" but not "batman car".
The SearchMode property controls whether to search in filenames, filenames and content, or deleted filenames. By default only filenames are searched.
The search results are provided through the SearchResult event, and the Resource properties. After calling this method set ResourceIndex to a value from 0 to ResourceCount - 1. Setting ResourceIndex populates other Resource properties to provide information about the resource.
After calling this method the following resource properties are populated:
- ResourceCount
- ResourceId
- ResourceMarker
- ResourceModifiedDate
- ResourceName
- ResourcePath
- ResourceRevision
- ResourceType
If the ResourceType is 1 (rtFolder) only the following properties are applicable:
If there are many search results, the results may be paged. If the results are paged the SearchMarker property will be populated. Continue calling this method with the same parameters to obtain the next page of results. After the last page of results is retrieved the SearchMarker property will be empty. MaxResults may be set to specify the maximum number of search results per page.
Example:
dropbox.Search("/My Photos","birthday"); for (int i = 0; i < dropbox.ResourceCount; i++) { dropbox.ResourceIndex = i; Console.WriteLine(dropbox.ResourceName); Console.WriteLine(dropbox.ResourceSize); Console.WriteLine(dropbox.ResourceModifiedDate); }