web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Problem - Get Files (p...
Power Automate
Answered

Problem - Get Files (properties only) is very hit/miss for grabbing the file properties

(0) ShareShare
ReportReport
Posted on by 253

Okay, this one is just getting frustrating; because it works 60% of the time, then the other 40% it just decides to not work for no reason at all.

I have 2 consistent problems; the short form of the questions are at the end of the post. For context, read the follwing.

Set-Up: The document library is like a sort of filing cabinet. It uses file properties to organize and sort all of the information.

It first groups employee folders by Manager, then by Active/Terminated status. Then Each employee has 17 folders within their folder for the respective files. The problem is that when a file is placed in a sub-folder it does not share the same file properties for tracking information; so, this means that we have to clear the filter every time we go into an employee's folder, otherwise the files are not visible. This flow is trying to solve that problem by grabbing the properties from the root-employee folder and updating the file properties of the uploaded file in the sub-folder.

Flow Process: When any file is created or modified within this document library, it grabs the file path. (The document being added is typically within one of the employee's 17 folders.) So, it grabs the file path and uses some compose actions to manipulate the string back to the root-employee folder path. Then, it uses Get Files (Properties only) to grab the employee folder with the property information needed.
Problem: I have tried numerous ways of grabbing the file, each one seems to have a 50/50 success rate... I just don't understand.
I have tried using FileLeafRef eq '(dynamic content_employee name)'

I have tried restricting the file search to a specific folder using dynamic content... It is all hit or miss, no consistency.
This is extremely frustrating, because I know it isn't the file names being incorrect or anything. IT IS ALL procedurally generated using flows! Which means that there isn't any room for human error to be impacting this; flows create the folders and paths, they update all of the properties...
Also, with the newer update to power automate, my conditions are all going haywire... They keep saying no input and defaulting to NO... 
Using a Null comparison used to work just fine....
I'm going to upload some images, and if someone could just help me modify some parts to make it function more smoothly, I would be so grateful.

 

Part 1: This is a Loop Kill condition
Because the flow modifies files within the document library, it would trigger itself. So, There is a hidden property that timestamps when the flow modifies a file. I had to include a Null condition, because if the information is empty, the flow fails.
Reads like this: IF(Flow mod is not Null) AND (is greater than utcnow() minus 2 minutes) = Terminate
In short, if the flow modified this file within the last 2 minutes, terminate (nevermind the bottom condition, I removed it).

Problem here: with the new update to P.A. I keep getting String/Integer errors and Null input errors... I've only ever had the null input error before, and it was corrected by the top, Null condition. To correct the String-Integer Error, I had set variables to be input to ensure proper format... Hit/Miss... Then I tried compose-outputs... still hit/miss. Realize... this works 50/50, sometimes it works just fine, other times, it just says null input and chooses the condition fail output.

Tmalonson_0-1704468878981.png


Part 2: The next part is fairly simple...
If the file hasn't been recently modified, it grabs the File Path.

Then, using some compose actions (Scope), it trims the FilePath down to just employee's name.
Then, Using Get Files (properties only) we use a Filter Query to search the Library for a folder with the Title of the employee's name.
FileLeafRef eq '(Compose outputs)'

Then, a compose (length) action tells us how many files were retrieved during the previous action.
Condition( if the file count is greater than zero, continue flow )

Problem: the Get Files only works 50/50, so half of the time it results in a termination (otherwise, it would just skip the following steps and say "Success"). This used to work JUST FINE until Power Automate did their update to the New Designer. Is there a better way to grab the files? I also have this issue on some other flows that used to work flawlessly.

Tmalonson_1-1704469770043.png

 

Part 3: the closing is just updating the file properties of the file that triggered the flow.
This normally works pretty well if everything else functions. Nevermind the odd input for "Name L,F", for some reason, it was not liking the dynamic input from get files, so I just used the Employee Name output from earlier in the flow.

Tmalonson_1-1704472350456.png


Closing Comments: Here's what I need help on.
1. Loop Kill Condition: Used to be that I could just use the Dynamic Content(Flow modified) from the trigger item and the condition would understand. But it looks like the new designer mixes up the data? You used to be able to compare the Date from SharePoint, and a Calculated Date within the flow. Now it gives String-Integer Errors. When I try to circumvent using compose/variable, I get null input and the condition just auto fails. Is there a better way?

2. Get Files (Properties Only): This used to work just fine... But now I can't seem to reliably grab the file properties that are needed. Frequently it returns with a Zero Result... Which is silly, because it pulled the Folder Path information from a document within that folder. Is there a better way to grab this information?
 



Categories:
I have the same question (0)
  • Verified answer
    Tmalonson Profile Picture
    253 on at

    Okay, I think I've managed to find a solution.
    It would appear that "Get Files" is failing because it is attempting to search nested items as well, which is causing it to return more than the threshold allows.
    By eliminating nested folders, it does consistently grab the correct file.

    Additionally, using Compose(Actions) to manage the condition(inputs) also seems to be working just fine, I no longer get a
    string-integer error. So, I am going to mark this as a solution because the flows seem to be working as intended now with these minor fixes.

  • CU05021442-0 Profile Picture
    2 on at
    I used the filter query (substringof('@{outputs('Reference')}.pdf',FileLeafRef)) in the screenshot below to filter for a specific file in my sharepoint library but the output returned empty 

    Value: [ ]

    I have also tried a different filter query using that goes thus FileLeafRef eq '@{outputs('Reference')}.pdf'








    Can anyone advice or help me with this? 

    I have a similar challenge as well, for some unknown reason, the filter query is able to get the file I need

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard