To search for a specific set of shared drives, use the query string q
with drives.list
to filter the drives to
return.
A query string contains the following three parts:
query_term operator values
Where:
query_term is the query term or field to search upon. To identify which query terms can be used to filter shared drives, refer to Shared drive query terms.
operator specifies the condition for the query term. To identify which operators you can use with each query term, refer to Query operators.
values are the specific values you want to use to filter your search results.
The following table shows some example search queries for shared drives:
Description | Query string | Required useDomainAdminAccess setting |
---|---|---|
Shared drives with no assigned organizer | organizerCount = 0 |
true |
Shared drives with the word 'confidential' in the title and 20 or more members | name contains 'confidential' and memberCount >= 20 |
true |
Shared drives created after June 1, 2017 | createdTime > '2017-06-01T12:00:00' |
true |
Shared drives visible in the default view | hidden = false |
false |
Query multiple terms with parentheses
You can use parentheses to group multiple query terms together. For example, to search for shared drives created after a specific date and that either have more than 5 organizers or more than 20 members, use this query:
createdTime > '2019-01-01T12:00:00' and (organizerCount > 5 or memberCount > 20)
This search returns all shared drives created after January 1st, 2019 and that have more than 5 organizers or more than 20 members.
Drive API evaluates and
and or
operators from left to right, so the same
search without parentheses would return:
- only shared drives with more than 5 organizers that were created after January 1st, 2019.
- all shared drives with more than 20 members, even those created before January 1st, 2019.