Link Menu Expand (external link) Document Search Copy Copied

List Files/Folders

📖 Definition

The “List files/folders” action allows users to retrieve a list of files and folders stored within a specified OneDrive for Business account. This action enables easy browsing and management of OneDrive content by returning detailed information about each item in the selected folder. Key capabilities include:

  1. Retrieving both files and folders from any location within OneDrive
  2. Supporting selection by folder path or folder ID for flexible targeting
  3. Providing comprehensive details for each item, including its name, type, path, URLs, and size (for files)

This action is essential for workflows that need to process, display, or manage OneDrive contents dynamically.


🎯 Example Use Cases

  1. Display Folder Contents in a Dashboard Retrieve a list of files and folders to dynamically show the contents of a OneDrive folder within a reporting dashboard or internal portal.


  2. Automate File Processing Automatically get a list of new files in a specific folder to trigger further actions like data extraction, conversion, or moving files.


  3. Archive Old Files Identify and list files in a folder that haven’t been modified recently, helping automate archiving or cleanup workflows.


  4. Generate File Inventory Reports Collect detailed metadata of files and folders for auditing or compliance purposes, providing an overview of storage usage and file types.


  5. Sync Folder Structure Retrieve folder lists to replicate or sync a OneDrive folder structure with another system or cloud storage service.



📥 Inputs

  1. Connection This field establishes a secure link between your workflow and your OneDrive. By signing in with your OneDrive credentials, the action gains permission to access your files and folders, ensuring that it can retrieve the information you need from your OneDrive storage.

  1. Selecting Folder Specify the folder from which you want to list files and folders. If you leave this field empty, the action will default to the root folder (the top-level directory) of your OneDrive.

    You can select the folder in two ways:

    • Using OneDrive Sign-In Picker: Click the field to open your OneDrive interface, where you can visually browse and pick the desired folder or file.
    • Manually Entering Folder ID or Path:

      • If ‘Select By Path’ is enabled, enter the folder’s path (for example, /drive/root:/Pictures).
      • If disabled, provide the folder’s unique ID (a string like 1EED600A8F0FD9A1!s75181466e59d4bacb1ec55930b932ed1).

    This flexibility allows you to target folders precisely, whether by browsing, hardcoding, or dynamically linking from previous steps.



📤 Outputs

  1. Files/Folders This output provides a list of all the files and folders found in the specified OneDrive folder. Each item in the list includes detailed information to help you understand and work with your OneDrive content.

  1. ID The unique identifier for each file or folder. This ID is used internally by OneDrive to precisely reference the item and can be useful for targeting specific files or folders in follow-up actions.

  1. Name The display name of the file or folder. This is the friendly, human-readable name you see in OneDrive, making it easy to recognize each item.

  1. Path The full location path of the file or folder within the user’s OneDrive. It shows where the item is stored relative to the root folder, helping you locate it quickly.

  1. Type Indicates whether the item is a file or a folder. This helps you differentiate between documents and directories when processing or displaying data.

  1. Web URL A link that opens the file or folder in the OneDrive web interface. This URL is convenient for sharing or reviewing items directly in the browser.

  2. Download URL (Files Only) A direct, pre-authenticated link to download the file’s content without requiring additional login. Use this URL to fetch the actual file data programmatically.


  1. MIME Type (Files Only) Describes the format of the file content using the standard MIME type system (e.g., application/pdf, image/png). This helps identify the file type for processing or filtering.

  1. Size (Files Only) The total size of the file in bytes. Knowing the file size can be useful for monitoring storage usage or deciding whether to download large files.


💡 Example

Scenario: You want to automate retrieving all files and folders from a specific OneDrive for Business folder called “Projects” within a Zenphi flow. This helps you process or monitor project files automatically without manual intervention.

Steps:

  1. Add the “List files/folders” Action Inside your Zenphi flow, insert the “List files/folders” action from the OneDrive category.

  2. Configure the Connection Use your existing OneDrive for Business connection or create a new one by signing in to authorize Zenphi to access your files.

  3. Specify the Folder In the Selecting Folder input, choose the “Projects” folder by:

    • Clicking the folder picker, which opens your OneDrive interface to select the folder visually, or
    • Providing the folder path (/drive/root:/Projects) if you have enabled ‘Select By Path’, or the folder ID if not.
  4. Trigger and Run Your FlowOnce configured, trigger your Zenphi flow manually, on a schedule, or based on other events. The action will retrieve all files and folders in the specified folder each time it runs.

  5. Use Outputs in Your FlowUtilize the output list (IDs, names, paths, etc.) in following actions, such as sending notifications, copying files, or generating reports.

Outcome: Your Zenphi flow automatically gathers up-to-date lists of files and folders from OneDrive, enabling seamless automation of file management tasks.