Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Để tìm một nhóm bộ nhớ dùng chung cụ thể, hãy sử dụng trường chuỗi truy vấn q với drives.list để lọc các bộ nhớ dùng chung cần trả về bằng cách kết hợp một hoặc nhiều cụm từ tìm kiếm.
Một chuỗi truy vấn bao gồm 3 phần sau:
query_term operator values
Trong trường hợp:
query_term là cụm từ hoặc trường truy vấn để tìm kiếm.
operator chỉ định điều kiện cho cụm từ tìm kiếm.
values là những giá trị cụ thể mà bạn muốn dùng để lọc kết quả tìm kiếm.
Ví dụ: chuỗi truy vấn sau đây sẽ lọc nội dung tìm kiếm để chỉ trả về những bộ nhớ dùng chung có tên "Tài nguyên Google Drive API".
q: name = 'Google Drive API resources' & useDomainAdminAccess=false
Ví dụ về chuỗi truy vấn
Bảng sau đây liệt kê ví dụ về một số chuỗi truy vấn cơ bản cho ổ đĩa dùng chung. Mã thực tế sẽ khác nhau tuỳ thuộc vào thư viện ứng dụng mà bạn sử dụng cho cụm từ tìm kiếm.
Bạn cũng phải thoát các ký tự đặc biệt trong tên tệp để đảm bảo truy vấn hoạt động chính xác. Ví dụ: nếu tên tệp chứa cả dấu nháy đơn (') và dấu gạch chéo ngược ("\"), hãy dùng dấu gạch chéo ngược để thoát các ký tự đó: name
contains 'quinn\'s paper\\essay'.
Nội dung bạn muốn truy vấn
Ví dụ:
Chế độ cài đặt useDomainAdminAccess
Bộ nhớ dùng chung được tạo sau ngày 1 tháng 6 năm 2017
createdTime > '2017-06-01T12:00:00'
true
Bộ nhớ dùng chung xuất hiện trong chế độ xem mặc định
hidden = false
false
Bộ nhớ dùng chung có nhiều thành viên
memberCount > 1
true
Bộ nhớ dùng chung có từ "bí mật" trong tiêu đề và có từ 20 thành viên trở lên
name contains 'confidential' and memberCount >= 20
true
Bộ nhớ dùng chung có từ "bí mật" trong tiêu đề trong số tất cả bộ nhớ dùng chung của tổ chức
name contains 'confidential' and orgUnitId = 'C03az79cb'
true
Bộ nhớ dùng chung có từ "bí mật" trong tiêu đề trong số tất cả bộ nhớ dùng chung mà người dùng là thành viên
name contains 'confidential'
false
Bộ nhớ dùng chung không có người tổ chức được chỉ định
organizerCount = 0
true
Bộ nhớ dùng chung không chứa mã nhận dạng đơn vị tổ chức
orgUnitId != 'C03az79cb'
true
Truy vấn nhiều cụm từ bằng dấu ngoặc đơn
Bạn có thể dùng dấu ngoặc đơn để nhóm nhiều cụm từ tìm kiếm lại với nhau. Ví dụ: để tìm bộ nhớ dùng chung được tạo sau một ngày cụ thể và có hơn 5 người tổ chức hoặc hơn 20 thành viên, hãy sử dụng cụm từ tìm kiếm sau:
createdTime > '2019-01-01T12:00:00' and (organizerCount > 5 or
memberCount > 20)
Lệnh tìm kiếm này sẽ trả về tất cả bộ nhớ dùng chung được tạo sau ngày 1 tháng 1 năm 2019 và có hơn 5 người tổ chức hoặc hơn 20 thành viên.
Drive API đánh giá các toán tử and và or từ trái sang phải, vì vậy, cùng một cụm từ tìm kiếm nhưng không có dấu ngoặc đơn sẽ trả về:
Chỉ những bộ nhớ dùng chung có hơn 5 người tổ chức và được tạo sau ngày 1 tháng 1 năm 2019.
Tất cả bộ nhớ dùng chung có hơn 20 thành viên, kể cả những bộ nhớ dùng chung được tạo trước ngày 1 tháng 1 năm 2019.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-08-29 UTC."],[],[],null,["# Search for shared drives\n\nTo search for a specific set of shared drives, use the query string `q` field\nwith [`drives.list`](/workspace/drive/api/reference/rest/v3/drives/list) to filter the drives to\nreturn by combining one or more search terms.\n\nA query string contains the following three parts:\n\n*`query_term operator values`*\n\nWhere:\n\n- *`query_term`* is the query term or field to search upon.\n\n | **Note:** Most query terms require `useDomainAdminAccess=true`. For more information about this flag, see [`drives.list`](/workspace/drive/api/reference/rest/v3/drives/list).\n- *`operator`* specifies the condition for the query term.\n\n- *`values`* are the specific values you want to use to filter your search\n results.\n\nTo view the query terms and operators that you can use to filter shared drives,\nsee [Search query terms and operators](/workspace/drive/api/guides/ref-search-terms#drive-properties).\n\nFor example, the following query string filters the search to only return shared\ndrives with the name \"Google Drive API resources.\" \n\n q: name = 'Google Drive API resources' & useDomainAdminAccess=false\n\nQuery string examples\n---------------------\n\nThe following table lists examples of some basic query strings for shared\ndrives. The actual code differs depending on the client library you use for your\nsearch.\n\nYou must also escape special characters in your file names to make sure the\nquery works correctly. For example, if a filename contains both an apostrophe\n(`'`) and a backslash (`\"\\\"`) character, use a backslash to escape them: `name\ncontains 'quinn\\'s paper\\\\essay'`.\n| **Note:** These examples show the unencoded `q` parameter, where `organizerCount =\n| 0` is encoded as `organizerCount+%3d+0`. Client libraries handle this encoding automatically.\n\n| What you want to query | Example | `useDomainAdminAccess` setting |\n|--------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|--------------------------------|\n| Shared drives created after June 1, 2017 | `createdTime \u003e '2017-06-01T12:00:00'` | `true` |\n| Shared drives visible in the default view | `hidden = false` | `false` |\n| Shared drives with more than one member | `memberCount \u003e 1` | `true` |\n| Shared drives with the word 'confidential' in the title and 20 or more members | `name contains 'confidential' and memberCount \u003e= 20` | `true` |\n| Shared drives with the word 'confidential' in the title among all shared drives of the organization | `name contains 'confidential' and orgUnitId = 'C03az79cb'` | `true` |\n| Shared drives with the word 'confidential' in the title among all shared drives that the user is a member of | `name contains 'confidential'` | `false` |\n| Shared drives with no assigned organizer | `organizerCount = 0` | `true` |\n| Shared drives that don't contain the organizational unit ID | `orgUnitId != 'C03az79cb'` | `true` |\n\nQuery multiple terms with parentheses\n-------------------------------------\n\nYou can use parentheses to group multiple query terms together. For example, to\nsearch for shared drives created after a specific date and that either have more\nthan five organizers or more than 20 members, use this query: \n\n createdTime \u003e '2019-01-01T12:00:00' and (organizerCount \u003e 5 or\n memberCount \u003e 20)\n\nThis search returns all shared drives created after January 1st, 2019 and that\nhave more than five organizers or more than 20 members.\n\nThe Drive API evaluates `and` and `or` operators from left to right,\nso the same search without parentheses would return:\n\n- Only shared drives with more than five organizers that were created after January 1st, 2019.\n- All shared drives with more than 20 members, even those created before January 1st, 2019.\n\nRelated topics\n--------------\n\n- [Search for files and folders](/workspace/drive/api/guides/search-files)\n- [Search query terms and operators](/workspace/drive/api/guides/ref-search-terms)"]]