Forum Discussion
How to use MS FLow and ODATA to filter a document library on file name?
- May 01, 2019
Erik,
Instead of using name as the filter, try FileLeafRef -
I was able to return all files from this library whose names start with the letter H.
Hope this helps.
Terry McCullagh
First of all, *thank you* for this solution, it's great ... and has saved me *hours*.
Secondly, I should say that I haven't come here to doubt anything. However, I noted that this stack notes that FileLeafRef is a bit ... flighty?
https://sharepoint.stackexchange.com/questions/241067/how-to-read-the-name-column-in-a-sharepoint-document-library
Is there a chance that this isn't the most reliable method, and we need to build a little logic scope to filter, as per Alice's ( @v-yuazh-msft ) answer in this question to be totally sure?:
https://powerusers.microsoft.com/t5/General-Flow-Discussion/Get-File-Properties-from-File-Name/td-p/157860
- Terry_McCullaghOct 14, 2019Brass Contributor
Eliot,
Thank you for reaching out and I'm glad this solution has saved you time.
I reviewed the posts you referenced and cannot comment on those since I haven't taken the time to try to reproduce any errors that may arise.
What I can say with certainty is using the solution as accepted by Erik Wettergren has worked for me in many a SharePoint tenant.
Perhaps @v-yuazh-msft can elaborate on the benefits of their answer.
Regards,
Terry
- eliotcole-projectfiveOct 15, 2019Brass Contributor
Terry_McCullagh ... Nice one, and thanks for the response, I respect that you didn't have to say anything! 🙂
I think that the approach that I will take is belt and braces. I'll ensure that I've got a fully annotated (commented) 'Pure Flow Logic' available to the user in what I call 'The Worst Timeline' * so that if it fails, then whomever is managing it can switch to that.
Thanks again, mate! 🙂
* A community reference used to describe a testing branch that I put in most Flows these days via a condition that's always set to run the main line. It'll contain notes, working (how did we get this JSON sample?), and alternates or future parts of the flow, plus some nonsense. Since it's not exactly the easiest place to organise separate Flows (at least, for free users) this feels like the easiest way to ensure that knowledge is available.
- zymantas123Jan 02, 2022Copper ContributorHello I have a problem with filtering. I used condition attachmentname ends with .pdf but one of three folders still accepts and .png format files. How I can resolve this?