October 16, 2024

Power Automate: OneDrive for Business – Get file metadata using path Action

It’s quite common to parse files in Power Automate, especially in bulk. But to parse files, we don’t need to get the file into Power Automate. We can get the file’s metadata and use it to do the necessary actions. The Flow runs in a fraction of the time by using the “Get file metadata using path” action instead of the “Get File Content Using Path Action” or the “Get File Content Action.”

So let’s explore what the “Get file metadata using path” action can offer us.

Where to find it?

OneDrive

To get it for your OneDrive:

You need to expand and search for “OneDrive.” Or you can search for it in the search bar, but be careful not to select “OneDrive for Business.”

Select “Get file metadata using path”:

This is what it looks like:

OneDrive for Business

To get it for your OneDrive for business, it’s displayed in the preview, but if you can’t find it for some reason, expand and search for it.

Select “Get file content using path”:

Looks the same as before.

Pro Tip:
Power Automate tends to save the most common actions in the main screen, so check there before going trough the full hierarchy. Also you can use the search to quickly find it.

Usage

You can use it in 2 ways:

  1. Select the file by selecting the folder icon and going through your folders until you find the file you want.
  1. Build the path dynamically and add it to the “File” field:

Let’s look at the first case:

Looks good. Let’s copy and paste the path and see what we get:

Looks awesome also. I chose this example for a reason. I decided to do the same example as in the Get file metadata action to see the difference. You can build the path yourself and provide it to the “Get file metadata using path” action, and all will work out.

Limitations

They have the same limitation as the “Get File Content Using Path Action” or the “Get File Content Action.” You can’t access files in a shared library. You can find here a workaround from the Power Automate Community.

Recommendations

Here are some things to keep in mind.

Name it correctly

The name is super important in this case since we’re getting the file by either calculating the path or having a defined static one. Always build the name so that other people can understand what you are using without opening the action and checking the details.

Always add a comment.

Adding a comment will also help to avoid mistakes. Indicate where the path comes from, for example, if it’s calculated and how. It’s important to enable faster debugging when something goes wrong.

Always deal with errors.

Have your Flow fail graciously when the file doesn’t exist and notify someone that something failed. It’s horrible to have failing Flows in Power Automate since they may go unlooked for a while or generate even worse errors. I have a template and a template that you can use to help you make your Flow resistant to issues. You can check all details here.

Am I missing something? Leave a comment or interact on Twitter. Let’s work together to make this reference as complete as we can

Back to the Power Automate Action Reference.

Photo by Russ Ward on Unsplash

Manuel Gomes

I have 18 years of experience in automation, project management, and development. In addition to that, I have been writing for this website for over 3 years now, providing readers with valuable insights and information. I hope my expertise allows me to create compelling, informative content that resonates with the audience.

View all posts by Manuel Gomes →

Leave a Reply

Your email address will not be published. Required fields are marked *

Mastodon