Today we’ll cover the same action on two different platforms. Almost two different platforms. OneDrive and OneDrive for Business. There’s a lot to cover between both, but one action is common for both and works the same way. The “Get File Content.”
It does exactly as advertised. You define a file, and the action fetches the file’s content and returns it to you.
Where to find it?
I’ll show you where to find it in both OneDrive and OneDrive for Business, but after this, I’ll use OneDrive for Business since both work the same way.
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 content,” and 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”:
Looks the same as before.
Power Automate tends to save the most common actions on the main screen, so check there before going through the full hierarchy. Also, you can use the search to find it quickly.
Usage
You can use it in 2 ways:
- Select the file by selecting the folder icon and going through your folders until you find the file you want.
- Build the path dynamically and add it to the “File” field:
As you can see above, the “unique identifier” of the file translates to the file path in your OneDrive tree (almost).
Let’s look at the first case:
Looks good. Let’s copy and paste the path and see what we get:
I chose this example for a reason.
Please be careful. If you want to get the file by path, there’s another action for that called (you guessed it), “Get file content using the path.”
Limitations
You need to use the identifier and not the file path. To get it, you can use another handy action called “Get file metadata using path” that will fetch the file details, including its unique identifier, in case you want to fetch the data.
In all fairness, I should not include it here as a limitation. It’s clear in the action that you should use the file identifier. I’m stressing it again because I see this mistake a lot!
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 the unique identifier. Always build the name so that other people can understand that you’re using the unique identifier and not the path. As you saw before, using the path will result in an error, and if the name is not clear, it will take some time to understand the issue.
Always add a comment.
Adding a comment will also help to avoid mistakes. Indicate that we’re providing the unique identifier and, if possible, the source where you’re getting it. This will enable faster debugging in case something goes wrong.
If you have a path
Don’t try to build a unique identifier yourself. Always fetch it from another connector because:
- You will always fail in getting the formula 100% correct.
- It’s a lot of work for nothing when another action will provide you the value always 100% correct.
- If a change in the underlying structure and the unique identifiers change, the Flow will continue to work properly.
Back to the Power Automate Action Reference.
Photo by Brett Jordan on Unsplash
I could not find this forever… no matter how many times I searched and searched… THANK YOU SO MUCHHH!!
Hi Harrison,
I’m so happy!!!! Glad it helped.
Anything else, please let me know.
Glad to help
Manuel
Great work! Thanks!
This is brilliant, thank you for pointing out the difference in using GetFileContent and GetFileContentUsingPath. It was driving me and several others crazy!
I’m so happy. I wrote it for exactly that reason! didn’t want anyone else to have to spend their time understanding that :).