List Files
Lists or searches files.
External Documentation
To learn more, visit the Google Drive documentation.
Basic Parameters
Parameter | Description |
---|---|
Drive ID | The ID of the shared drive to list files from.Note: When the drive ID parameter is provided, the following parameters are required:
|
Query | A query for filtering the file results. See the "Search for Files" guide for supported syntax. |
Advanced Parameters
Parameter | Description |
---|---|
Delegated User Override | Perform the action on behalf of another user, overriding the delegated user defined in the connection.If not specified, the delegated user is the one provided in the connection.Has no effect when using an OAuth connection.NOTE: the connection details are not edited by this input. |
Fields | Selector specifying which fields to include in a partial response. |
File Grouping (Corpora) | Groupings of files to which the query applies. Supported groupings are: 'user' (files created by, opened by, or shared directly with the user), 'drive' (files in the specified shared drive as indicated by the 'driveId'), 'domain' (files shared to the user's domain), and 'allDrives' (A combination of 'user' and 'drive' for all drives where the user is a member). When able, use 'user' or 'drive', instead of 'allDrives', for efficiency. |
Include Items From All Drives | Whether both My Drive and shared drive items should be included in results. |
Include Labels | A comma-separated list of IDs of labels to include in the labelInfo part of the response. |
Include Permissions For View | Specifies which additional view's permissions to include in the response. Only 'published' is supported. |
Order By | 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. |
Spaces | A list of spaces to query within the grouping. Supported values are 'drive' and 'appDataFolder'. |
Supports All Drives | Whether the requesting application supports both My Drives and shared drives. |
Example Output
{
"files": [
{
"appProperties": {},
"capabilities": {
"canAcceptOwnership": false,
"canAddChildren": false,
"canAddFolderFromAnotherDrive": false,
"canAddMyDriveParent": false,
"canChangeCopyRequiresWriterPermission": false,
"canChangeSecurityUpdateEnabled": false,
"canChangeViewersCanCopyContent": false,
"canComment": false,
"canCopy": false,
"canDelete": false,
"canDeleteChildren": false,
"canDownload": false,
"canEdit": false,
"canListChildren": false,
"canModifyContent": false,
"canModifyContentRestriction": false,
"canModifyLabels": false,
"canMoveChildrenOutOfDrive": false,
"canMoveChildrenOutOfTeamDrive": false,
"canMoveChildrenWithinDrive": false,
"canMoveChildrenWithinTeamDrive": false,
"canMoveItemIntoTeamDrive": false,
"canMoveItemOutOfDrive": false,
"canMoveItemOutOfTeamDrive": false,
"canMoveItemWithinDrive": false,
"canMoveItemWithinTeamDrive": false,
"canMoveTeamDriveItem": false,
"canReadDrive": false,
"canReadLabels": false,
"canReadRevisions": false,
"canReadTeamDrive": false,
"canRemoveChildren": false,
"canRemoveMyDriveParent": false,
"canRename": false,
"canShare": false,
"canTrash": false,
"canTrashChildren": false,
"canUntrash": false
},
"contentHints": {
"indexableText": "Text to be indexed for the file to improve fullText queries. This is limited to 128KB in length and may contain HTML elements.",
"thumbnail": {
"image": "The thumbnail data encoded with URL-safe Base64 (RFC 4648 section 5).",
"mimeType": "The MIME type of the thumbnail."
}
},
"contentRestrictions": [
{
"readOnly": false,
"reason": "Reason for why the content of the file is restricted. This is only mutable on requests that also set readOnly=true.",
"restrictingUser": {
"displayName": "A plain text displayable name for this user.",
"emailAddress": "The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.",
"kind": "drive#user",
"me": false,
"permissionId": "The user's ID as visible in Permission resources.",
"photoLink": "A link to the user's profile photo, if available."
},
"restrictionTime": "The time at which the content restriction was set (formatted RFC 3339 timestamp). Only populated if readOnly is true.",
"type": "The type of the content restriction. Currently the only possible value is globalContentRestriction."
}
],
"copyRequiresWriterPermission": false,
"createdTime": "The time at which the file was created (RFC 3339 date-time).",
"description": "A short description of the file.",
"driveId": "ID of the shared drive the file resides in. Only populated for items in shared drives.",
"explicitlyTrashed": false,
"exportLinks": {},
"fileExtension": "The final component of fullFileExtension. This is only available for files with binary content in Google Drive.",
"folderColorRgb": "The color for a folder or shortcut to a folder as an RGB hex string. The supported colors are published in the folderColorPalette field of the About resource.\nIf an unsupported color is specified, the closest color in the palette will be used instead.",
"fullFileExtension": "The full file extension extracted from the name field. May contain multiple concatenated extensions, such as \"tar.gz\". This is only available for files with binary content in Google Drive.\nThis is automatically updated when the name field changes, however it is not cleared if the new name does not contain a valid extension.",
"hasAugmentedPermissions": false,
"hasThumbnail": false,
"headRevisionId": "The ID of the file's head revision. This is currently only available for files with binary content in Google Drive.",
"iconLink": "A static, unauthenticated link to the file's icon.",
"id": "The ID of the file.",
"imageMediaMetadata": {
"aperture": 0,
"cameraMake": "The make of the camera used to create the photo.",
"cameraModel": "The model of the camera used to create the photo.",
"colorSpace": "The color space of the photo.",
"exposureBias": 0,
"exposureMode": "The exposure mode used to create the photo.",
"exposureTime": 0,
"flashUsed": false,
"focalLength": 0,
"height": 0,
"isoSpeed": 0,
"lens": "The lens used to create the photo.",
"location": {
"altitude": 0,
"latitude": 0,
"longitude": 0
},
"maxApertureValue": 0,
"meteringMode": "The metering mode used to create the photo.",
"rotation": 0,
"sensor": "The type of sensor used to create the photo.",
"subjectDistance": 0,
"time": "The date and time the photo was taken (EXIF DateTime).",
"whiteBalance": "The white balance mode used to create the photo.",
"width": 0
},
"isAppAuthorized": false,
"kind": "drive#file",
"labelInfo": {
"labels": [
{
"fields": {},
"id": "The ID of the label.",
"kind": "drive#label",
"revisionId": "The revision ID of the label."
}
]
},
"lastModifyingUser": {
"displayName": "A plain text displayable name for this user.",
"emailAddress": "The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.",
"kind": "drive#user",
"me": false,
"permissionId": "The user's ID as visible in Permission resources.",
"photoLink": "A link to the user's profile photo, if available."
},
"linkShareMetadata": {
"securityUpdateEligible": false,
"securityUpdateEnabled": false
},
"md5Checksum": "The MD5 checksum for the content of the file. This is only applicable to files with binary content in Google Drive.",
"mimeType": "The MIME type of the file.\nGoogle Drive will attempt to automatically detect an appropriate value from uploaded content if no value is provided. The value cannot be changed unless a new revision is uploaded.\nIf a file is created with a Google Doc MIME type, the uploaded content will be imported if possible. The supported import formats are published in the About resource.",
"modifiedByMe": false,
"modifiedByMeTime": "The last time the file was modified by the user (RFC 3339 date-time).",
"modifiedTime": "The last time the file was modified by anyone (RFC 3339 date-time).\nNote that setting modifiedTime will also update modifiedByMeTime for the user.",
"name": "The name of the file. This is not necessarily unique within a folder. Note that for immutable items such as the top level folders of shared drives, My Drive root folder, and Application Data folder the name is constant.",
"originalFilename": "The original filename of the uploaded content if available, or else the original value of the name field. This is only available for files with binary content in Google Drive.",
"ownedByMe": false,
"owners": [
{
"displayName": "A plain text displayable name for this user.",
"emailAddress": "The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.",
"kind": "drive#user",
"me": false,
"permissionId": "The user's ID as visible in Permission resources.",
"photoLink": "A link to the user's profile photo, if available."
}
],
"parents": [
"string"
],
"permissionIds": [
"string"
],
"permissions": [
{
"allowFileDiscovery": false,
"deleted": false,
"displayName": "The \"pretty\" name of the value of the permission. The following is a list of examples for each type of permission: \n- user - User's full name, as defined for their Google account, such as \"Joe Smith.\" \n- group - Name of the Google Group, such as \"The Company Administrators.\" \n- domain - String domain name, such as \"thecompany.com.\" \n- anyone - No displayName is present.",
"domain": "The domain to which this permission refers.",
"emailAddress": "The email address of the user or group to which this permission refers.",
"expirationTime": "The time at which this permission will expire (RFC 3339 date-time). Expiration times have the following restrictions: \n- They cannot be set on shared drive items \n- They can only be set on user and group permissions \n- The time must be in the future \n- The time cannot be more than a year in the future",
"id": "The ID of this permission. This is a unique identifier for the grantee, and is published in User resources as permissionId. IDs should be treated as opaque values.",
"kind": "drive#permission",
"pendingOwner": false,
"permissionDetails": [
{
"inherited": false,
"inheritedFrom": "The ID of the item from which this permission is inherited. This is an output-only field.",
"permissionType": "The permission type for this user. While new values may be added in future, the following are currently possible: \n- file \n- member",
"role": "The primary role for this user. While new values may be added in the future, the following are currently possible: \n- organizer \n- fileOrganizer \n- writer \n- commenter \n- reader"
}
],
"photoLink": "A link to the user's profile photo, if available.",
"role": "The role granted by this permission. While new values may be supported in the future, the following are currently allowed: \n- owner \n- organizer \n- fileOrganizer \n- writer \n- commenter \n- reader",
"teamDrivePermissionDetails": [
{
"inherited": false,
"inheritedFrom": "Deprecated - use permissionDetails/inheritedFrom instead.",
"role": "Deprecated - use permissionDetails/role instead.",
"teamDrivePermissionType": "Deprecated - use permissionDetails/permissionType instead."
}
],
"type": "The type of the grantee. Valid values are: \n- user \n- group \n- domain \n- anyone When creating a permission, if type is user or group, you must provide an emailAddress for the user or group. When type is domain, you must provide a domain. There isn't extra information required for a anyone type.",
"view": "Indicates the view for this permission. Only populated for permissions that belong to a view. published is the only supported value."
}
],
"properties": {},
"quotaBytesUsed": "The number of storage quota bytes used by the file. This includes the head revision as well as previous revisions with keepForever enabled.",
"resourceKey": "A key needed to access the item via a shared link.",
"sha1Checksum": "The SHA1 checksum associated with this file, if available. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.",
"sha256Checksum": "The SHA256 checksum associated with this file, if available. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.",
"shared": false,
"sharedWithMeTime": "The time at which the file was shared with the user, if applicable (RFC 3339 date-time).",
"sharingUser": {
"displayName": "A plain text displayable name for this user.",
"emailAddress": "The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.",
"kind": "drive#user",
"me": false,
"permissionId": "The user's ID as visible in Permission resources.",
"photoLink": "A link to the user's profile photo, if available."
},
"shortcutDetails": {
"targetId": "The ID of the file that this shortcut points to.",
"targetMimeType": "The MIME type of the file that this shortcut points to. The value of this field is a snapshot of the target's MIME type, captured when the shortcut is created.",
"targetResourceKey": "The ResourceKey for the target file."
},
"size": "The size of the file's content in bytes. This is applicable to binary files in Google Drive and Google Docs files.",
"spaces": [
"string"
],
"starred": false,
"teamDriveId": "Deprecated - use driveId instead.",
"thumbnailLink": "A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours. Only populated when the requesting app can access the file's content. If the file isn't shared publicly, the URL returned in Files.thumbnailLink must be fetched using a credentialed request.",
"thumbnailVersion": "The thumbnail version for use in thumbnail cache invalidation.",
"trashed": false,
"trashedTime": "The time that the item was trashed (RFC 3339 date-time). Only populated for items in shared drives.",
"trashingUser": {
"displayName": "A plain text displayable name for this user.",
"emailAddress": "The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.",
"kind": "drive#user",
"me": false,
"permissionId": "The user's ID as visible in Permission resources.",
"photoLink": "A link to the user's profile photo, if available."
},
"version": "A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the user.",
"videoMediaMetadata": {
"durationMillis": "The duration of the video in milliseconds.",
"height": 0,
"width": 0
},
"viewedByMe": false,
"viewedByMeTime": "The last time the file was viewed by the user (RFC 3339 date-time).",
"viewersCanCopyContent": false,
"webContentLink": "A link for downloading the content of the file in a browser. This is only available for files with binary content in Google Drive.",
"webViewLink": "A link for opening the file in a relevant Google editor or viewer in a browser.",
"writersCanShare": false
}
],
"incompleteSearch": false,
"kind": "drive#fileList",
"nextPageToken": "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."
}
Workflow Library Example
Perform Weekly Cleanup of Externally Shared Files and Folders in Google Drive
Preview this Workflow on desktop