Search Method

Searches for resources that match the specified query.

Syntax

int Search(const QString& qsQuery);

Remarks

This method searches for resources that match the given Query, which the server will match against names, descriptions, file contents, etc.

Advanced searches can be performed by adding additional query parameters using the AddQueryParam method. Here are examples of some of the more common query parameters:

Query Parameter Name Example Value Description
type folder Restrict results to resources of the given type.
file_extensions png,docx,pdf Restrict results to files with one of the given extensions.
ancestor_folder_ids d:12345,d:0,d:67890 Restrict results to resources within (recursively) one or more of the specified folders

Box supports many other query parameters not shown here. Refer to the Box API documentation for an exhaustive list of possible query parameters.

Calling this method will fire the ResourceList event once for each search result, and will also populate the Resource* properties.

If there are still more search results available to list when this method returns, the SearchMarker property will be populated. Continue to call this method until SearchMarker is empty to accumulate all pages of results in the Resource* properties.

The MaxSearchResults configuration setting can be used to control the maximum number of results to return at once.

Error Handling

This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Cloud 2020 Qt Edition - Version 20.0 [Build 8265]