Files and folders
A metadata query will only return items (files or folders) to which the requesting user has at leastpreviewer access.
Enterprise vs Global templates
A metadata query only works with metadata templates that have been created by that enterprise. A query will not return results based on the content of free form key-value pairs stored in theglobal.properties template.
Classification metadata templates
Box uses metadata templates to power its content classification. These metadata templates can not be used in metadata queries, as they will most likely run into issues regarding large results sets. More on this next. There are no immediate plans to start supporting these queries in the future.Recommended result set size
Where possible, it is recommended to only send requests for which the result set is less than 2,000 items. The result set is the entire collection of files and folders that match the metadata query exclusively based on evaluating thefrom, query, and query_params parameters — before the requesting
user’s permissions and the ancestor_folder scope are considered.
When sending a metadata query request for which the result set exceeds 2,000
items, the API can only guarantee that it returns all matching results if
both the following conditions are met:
- The requesting user has at least Previewer permission to all items in the result set
- The ancestor folder contains all of the files in the result set
catalogImages which has one string field called
photographer.
catalogImages template
applied.
Now consider that there are 4,000 files in your Box enterprise
which have the catalogImages template applied and which are split evenly
between the two folders, Parts and Products, which are children of the
parent folder Catalog as shown below.
from, query, and query_params parameters — before the requesting user’s permissions and the ancestor_folder scope are considered.
| Query | Result Set | Outcome | Notes |
|---|---|---|---|
Select items with the catalogImages template where the photographer is Mike | 200 items | Success | By only selecting items for Mike the result set is constrained to only 400 files |
Select items with the catalogImages template | 4,000 items | May fail | The result set exceeds 2,000 items. If the user does not have access to all of the files in the result set the query may fail |
Select items with the catalogImages template in the Products folder | 4,000 items | May fail | The result set exceeds 2,000 items and not all results are contained within the ancestor folder. |
Select items with the catalogImages template in the Products folder where the photographer is Mike | 200 items | Success | By only selecting items for Mike the result set is constrained to only 400 files |
