List User's Shared Files

📖Definition

The "List User's Shared Files" action allows you to search for and retrieve all files and folders that a specified Google Workspace user has shared externally, either via link, domain sharing, or direct email sharing.
This action is designed to give administrators detailed visibility into users' externally shared content, helping manage data security and compliance.

Key capabilities include:

  • Filtering shared files based on sharing type (link, domain, or external email).
  • Choosing where to search (My Drive, Shared Drives, or all drives).
  • Customizing results by file type, trash status, advanced queries, sorting, and more.
  • Returning detailed metadata about each shared file or folder, including ownership, permissions, and access links.

🎯Example Use Cases

1. Audit User's Externally Shared Files

Regularly review all files a specific user has shared outside the organization to ensure compliance with company data policies.

2. Detect Publicly Accessible Files

Identify files shared via public links, allowing security teams to take action if sensitive documents are found accessible by anyone.

3. Monitor Domain-Wide Sharing

List files that are shared with everyone in the company domain, helping manage internal data visibility and access control.

4. Investigate Suspicious Sharing Activity

Quickly retrieve a list of files shared with external email addresses if a potential data leak or suspicious user behavior is detected.

5. Prepare for User Offboarding

Before deactivating a user's account, compile a list of all externally shared files they own to review and reassign ownership if necessary.


📥Inputs

Connection

Select an existing Google Workspace Administration connection.

Note: You must have uploaded a service account credential JSON file with domain-wide delegation. Learn how to create it here.

User Email

Enter the primary email address of the user whose shared files you want to retrieve.

Sharing Type

Choose the type of externally shared files or folders you want to list:

  • Shared with Link (files shared via a public link)
  • Domain Shared (files shared within your company domain)
  • Shared with External Email Address (files shared directly with external users)

Search Location

Specify where to search for the files or folders:

  • All Drives (includes personal and shared drives)
  • My Drive (only the user's personal drive)
  • Shared Drive (search within a specific shared drive)

Search For

Select whether to include Files, Folders, or Both in the results.

Exclude Trashed Items

Choose whether to exclude items that have been placed in the Trash:

  • Yes (exclude trashed items)
  • No (include trashed items)

Query

Add a custom query to filter the item results more precisely.

Important: For details on query terms and operators, see Google Drive API Query Reference.
For example queries, check here.

Order By

Define how the results should be sorted.
Supported fields include:

  • createdTime, folder, modifiedByMeTime, modifiedTime, name, quotaBytesUsed, sharedWithMeTime, starred, viewedByMeTime, etc.
    You can sort in descending order by adding desc. Example: folder,modifiedTime desc,name

Include Labels

Specify a comma-separated list of label IDs to include in the label information part of the response.

Spaces

Set where to search within the Drive environment:

  • drive (the user’s regular Drive space)
  • appDataFolder (application-specific data space)

Corpora

Define the groupings of files to which the query applies:

  • user (files created by or shared with the user)
  • drive (files in a specific shared drive)
  • domain (files shared to the user's entire domain)
  • allDrives (a combination of user and shared drive files)

Number of Items to Process

Set the maximum number of files/folders to check for sharing.

Must be between 1 and 5,000.

Page Token

If you're paginating results, provide the token to retrieve the next page.
If left blank, the first page of results will be retrieved.


📌 Important Note:

To build powerful and customized searches when using the Query field, you can use specific search terms and operators provided by Google Drive API.

Using the right queries will help you find exactly the files or folders you need!


📤 Outputs

  1. Result Count

    This indicates the total number of files or folders that match your search criteria. If there is a Next Page Token, it means there are more items to retrieve.

  2. Files/Folders

    This section lists the details of the files or folders that were found based on your search. It contains various fields that provide more information about each item.

    • Id

      The unique identifier for the file or folder. This ID can be used to reference the item in subsequent actions or API calls.

    • Drive Id

      The ID of the shared drive where the file or folder resides. This will only be populated for files that are part of shared drives.

    • Description

      A brief description of the file or folder. This field provides a short summary or context about the item, if available.

    • Name

      The name of the file or folder. This is the title given to the item when it was created or uploaded to Google Drive.

    • Mime Type

      The MIME type of the file, indicating the format or type of the file (e.g., document, image, PDF, etc.).

    • Version

      The version number of the file. This helps in tracking if the file has been updated or changed.

    • View Link

      A clickable link that can be used to open the file in the relevant Google editor or viewer in a browser.

    • Original Filename

      The original name of the file when it was uploaded, if available. This is particularly useful for binary files (e.g., images, PDFs) that might have been renamed after uploading.

    • File Extension

      The file extension (like .pdf, .jpg, etc.) extracted from the file's name. It tells you the file format.

    • Download Link

      A URL link to download the file content directly from Google Drive.

    • Size

      The size of the file in bytes, providing information about how large the file is.

    • Trashed

      Indicates whether the file has been placed in the Trash (deleted), either manually or because it’s in a trashed parent folder.

    • Modified Time

      The timestamp of the last time the file was modified by anyone. This tells you when the file was last updated.

    • Created Time

      The timestamp of when the file or folder was created. This is useful for tracking when an item was originally added to Google Drive.

    • Owners

      The owners of the file or folder. It includes the owner's display name and email address. Owners have full control over the file or folder.

      • Display Name

        The display name of the user who owns the file or folder.

      • Email Address

        The email address of the owner.

    • Permissions

      This lists the permissions associated with the file, showing who has access to it and what kind of access they have (e.g., owner, editor, viewer).

      Id

      The unique ID associated with the permission.

      Display Name

      The display name of the user or group who has the permission.

      Type

      The type of the permission. Possible types include user, group, domain, and anyone.

      Email Address

      The email address of the user or group associated with the permission.

      Role

      The specific role granted by the permission, such as owner, editor, viewer, etc.

      Domain

      The domain for the permission. For example, this could be your organization's domain (e.g., @yourcompany.com).

      Deleted

      Indicates whether the account associated with the permission has been deleted. This is only relevant for user or group permissions.

      Pending Owner

      Indicates whether the account is a pending owner of the file. This is useful for file ownership transitions.

      Allow File Discovery

      Specifies whether the file is discoverable via search. This applies to domain-level or anyone-level permissions.

    • Parents

      The unique identifiers of the parent folders that contain the file. This helps you understand the hierarchical structure of the file.

    • Shared

      Indicates whether the file has been shared. This will not be populated for files located in shared drives.

  3. Next Page Token

    This token allows you to retrieve additional results if there are more files or folders that match the search criteria. If this field is absent, it means you've reached the end of the results list.


💡 Example: Listing User's Shared Files

**Scenario:**Suppose a company has a team of employees who collaborate on Google Drive, and an administrator wants to gather a list of all files shared with external partners. The administrator wants to review these shared files to ensure that sensitive information is properly protected.

Steps to Set It Up:

  1. Connection: The administrator establishes a connection to Google Workspace using the appropriate credentials, ensuring that the connection has the necessary permissions to access files across the organization.

  2. User Email: The administrator specifies the email address of the user whose shared files are to be listed, for example, "[email protected]".

  3. Sharing Type: The administrator chooses Shared with External Email Address to filter the files shared with external partners, ensuring only externally shared files are listed.

  4. Search Location: The administrator selects All Drives to search across both the user’s My Drive and any shared drives they are a part of.

  5. Search For: The administrator opts to search for Files, excluding folders, as they are interested only in files that have been shared.

  6. Exclude Trashed Items: The administrator selects Yes to ensure that files marked as "trashed" are excluded from the results, as they are no longer relevant.

  7. Query: The administrator enters a query to filter results, such as mimeType = 'application/pdf', to only list PDF files shared with external partners.

  8. Order By: The administrator chooses to sort the results by modifiedTime, so the most recently modified shared files are listed at the top.

  9. Number of Items to Process: The administrator sets a limit, such as 500, to ensure that the query does not return an overwhelming number of results.

  10. Running the Flow: Once the flow is triggered, the system returns a list of files shared externally, providing all relevant details such as the file name, size, owner, and the permissions associated with each file.

**Outcome:**The administrator can now review the list of shared files, ensuring that only authorized external users have access to sensitive information, and can take corrective actions if needed. This action helps maintain security and oversight in file sharing within the organization.