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 DashboardRetrieve a list of files and folders to dynamically show the contents of a OneDrive folder within a reporting dashboard or internal portal.

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

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

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

  1. Sync Folder StructureRetrieve folder lists to replicate or sync a OneDrive folder structure with another system or cloud storage service.


📥 Inputs

  1. ConnectionThis 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 FolderSpecify 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/FoldersThis 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. IDThe 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. NameThe 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. PathThe 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. TypeIndicates whether the item is a file or a folder. This helps you differentiate between documents and directories when processing or displaying data.

  1. Web URLA 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.

  1. 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" ActionInside your Zenphi flow, insert the "List files/folders" action from the OneDrive category.

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

  3. Specify the FolderIn 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.