I am trying to create a flow that triggers when a file is created in a specified folder in OneDrive for Business. The folder will contain searchable PDFs. I want to copy or move the file to a specified folder if it contains a specific term. When I manually search the sale OneDrive folder for the same term the search returns the correct PDF. However the logic fails as a Flow.
I have created a condition on the object 'File Contents', using the relationship 'Contains', and various values, which always resolves to 'No'. I've attached to images and for this example I used 'date' for the value. I've tried other values to no avail -- in each case I am just looking for a string, not a field.
I can't figure out what is incorrect. Does the string need to be in quotes? Is it case sensitive? Is this not the correct way to search within a file for a specific string?
I have just tested with a similar flow and I got the same result.
My flow is like below. And I added quotation marks just in case this is the issue:
I have multiple "test" strings in a Word document and I got the below result:
Tested with PDF file ended up with the same result.
It seems that file content cannot be used to search strings inside the file.
I suggest that you can post this as an idea to the Flow Idea forum so that it could be considered in future release:
I appreciate your thoughts on this. What is 'file contents' for then? I don't understand why the same search parameters return the correct file in OneDrive search, but can't be used as a criteria in Flow?
I was able to get this working by putting the file content inside a string.
My Flow steps are as follows:
1) When a file is modified
2) Get file content
Fill out a quick form to claim your user group badge now!
We've given our badges an overhaul and also added some brand new ones!
Learn how to build the business apps that you need.
Find out where you can attend!
Watch & learn from the Power Automate Community Video Gallery!