How to Retrieve Only Files (Exclude Folders) from a SharePoint Library Using Power Automate 'Get Files'​ Action: A Step-by-Step Guide

 When working with SharePoint libraries in Power Automate, it's common to use the "Get files (properties only)" action to retrieve a list of files from a library. However, this action may also retrieve folders, which can be problematic if you only need to work with files.


Fortunately, you can use the "Filter Query" field in the "Get files (properties only)" action to retrieve only files from a SharePoint library. In this article, we'll walk you through the steps to retrieve only files from a SharePoint library using Power Automate.

Step 1: Create a New Flow


First, create a new flow in Power Automate. You can choose to create a blank flow or use a template that includes the "Get files (properties only)" action.


Step 2: Add the "Get files (properties only)" Action


Next, add the "Get files (properties only)" action to your flow. You'll need to specify the SharePoint site URL and the library name that contains the files you want to retrieve.

No alt text provided for this image
www.Devanalytics365.com

Step 3: Configure the Filter Query


To retrieve only files from the SharePoint library, you'll need to add a filter query to the "Get files (properties only)" action. Click the "Show advanced options" link to reveal the "Filter Query" field, and then enter the following filter query:

FSObjType eq 0

No alt text provided for this image
www.Devanalytics365.com


No alt text provided for this image
www.Devanalytics365.com

This filter retrieves all files where the "FSObjType" property is equal to 0, which indicates a file. The "FSObjType" property is a built-in SharePoint property that specifies the type of object in the library, with 0 indicating a file and 1 indicating a folder.


Step 4: Save and Test Your Flow


Save your flow and then test it to verify that it only retrieves files from the SharePoint library. You can do this by adding a "Compose" action after the "Get files (properties only)" action and examining the output.

www.Devanalytics365.com

When you run the flow, the "Compose" action should only display information about files, not folders. If you need to perform additional actions on the files, such as copying them to another location, you can add those actions after the "Get files (properties only)" action.


In conclusion, the "Get files (properties only)" action in Power Automate can retrieve both files and folders from a SharePoint library. However, by using a filter query, you can easily retrieve only files from the library. The "FSObjType eq 0" filter query ensures that only files are returned in the output, allowing you to work with files more efficiently.

www.Devanalytics365.com


Keywords:

  • SharePoint
  • Power Automate
  • Get Files action
  • Retrieve Files
  • Exclude Folders
  • Filter Query
  • SharePoint Library
  • Files vs Folders
  • Document Management
  • Automation
  • Workflow

Comments