Files: list

Lists or searches files. Try it now.

This method accepts the q parameter, which is a search query combining one or more search terms. For more information, see the Search for files guide.


HTTP request



Parameter name Value Description
Optional query parameters
corpora string Bodies of items (files/documents) to which the query applies. Supported bodies are 'user', 'domain', 'drive' and 'allDrives'. Prefer 'user' or 'drive' to 'allDrives' for efficiency.
corpus string The source of files to list. Deprecated: use 'corpora' instead.

Acceptable values are:
  • "domain": Files shared to the user's domain.
  • "user": Files owned by or shared to the user.
driveId string ID of the shared drive to search.
fields string The paths of the fields you want included in the response. If not specified, the response includes a default set of fields specific to this method. For development you can use the special value * to return all fields, but you'll achieve greater performance by only selecting the fields you need. For more information see the partial responses documentation.
includeItemsFromAllDrives boolean Deprecated - Whether both My Drive and shared drive items should be included in results. This parameter will only be effective until June 1, 2020. Afterwards shared drive items will be included in the results. (Default: false)
includeTeamDriveItems boolean Deprecated use includeItemsFromAllDrives instead. (Default: false)
orderBy string A comma-separated list of sort keys. Valid keys are 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime', 'name', 'name_natural', 'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', and 'viewedByMeTime'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedTime desc,name. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.
pageSize integer The maximum number of files to return per page. Partial or empty result pages are possible even before the end of the files list has been reached. Acceptable values are 1 to 1000, inclusive. (Default: 100)
pageToken string The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.
q string A query for filtering the file results. See the "Search for files" guide for the supported syntax.
spaces string A comma-separated list of spaces to query within the corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.
supportsAllDrives boolean Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives. (Default: false)
supportsTeamDrives boolean Deprecated use supportsAllDrives instead. (Default: false)
teamDriveId string Deprecated use driveId instead.

Request body

Do not supply a request body with this method.


If successful, this method returns a response body with the following structure:

  "kind": "drive#fileList",
  "nextPageToken": string,
  "incompleteSearch": boolean,
  "files": [
    files Resource
Property name Value Description Notes
kind string Identifies what kind of resource this is. Value: the fixed string "drive#fileList".
nextPageToken string The page token for the next page of files. This will be absent if the end of the files list has been reached. If the token is rejected for any reason, it should be discarded, and pagination should be restarted from the first page of results.
files[] list The list of files. If nextPageToken is populated, then this list may be incomplete and an additional page of results should be fetched.
incompleteSearch boolean Whether the search process was incomplete. If true, then some search results may be missing, since all documents were not searched. This may occur when searching multiple drives with the "allDrives" corpora, but all corpora could not be searched. When this happens, it is suggested that clients narrow their query by choosing a different corpus such as "user" or "drive".

Try it!

Use the APIs Explorer below to call this method on live data and see the response.

다음에 대한 의견 보내기...

도움이 필요하시나요? 지원 페이지를 방문하세요.