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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Get Files filtering by...
Power Automate
Answered

Get Files filtering by file name using ODATA query fails with FileLeafRef fails for some files (not all)

(0) ShareShare
ReportReport
Posted on by 229

Hi, 

 

I'm having an issue that I am not able to solve. Will appreciate any help on this matter.

 

I have a SharePoint List with a list of files and Owners. I also have a SharePoint Library with the files. 

I want to assign the owners to the SharePoint Library too.  The SharePoint List is something like that:

 

Files_Index

File 1 - Owner A

File 2 - Owner B

File 3 - Owner A

 

As a summary my flow is doing the following:

  1. Get Items (from Files_Index)
  2. Apply to Each
  3. Get files (properties only)
    1. Filter Query: FileLeafRef eq 'AttachmentFileName'
  4. Update file properties

 

That works for the most of files but not for all of them. I've made some test running the flow individually for each file, and same flow works fine with File 1, File 2, but not with file 3.

The expression "FileLeafRef eq 'File 3'" is not valid. Creating query failed. clientRequestId: xxxxxx. serviceRequestId: xxxxxxxxxxxx

 

It seems it can't create the query for some reason, but I've checked the file name in the library and in the list and it matches. so not really sure what is happening.

 

Any help will be much appreciated.

 

Kind Regards

 

 

Categories:
I have the same question (0)
  • v-bacao-msft Profile Picture
    Microsoft Employee on at

     

    Hi @Sam4 ,

     

    Could you share the full screenshot of the flow configuration so that we could check the error easily?

     


    @Sam4 wrote:

    I have a SharePoint List with a list of files and Owners.


    Do you mean that the file is stored in the attachment of the item?

     

     

    Best Regards,

  • Verified answer
    Sam4 Profile Picture
    229 on at

    Hi @v-bacao-msft thanks for your reply.

     

    The files are stored in the Library, the list only has two text columns: filename and owner. I wanted to add the column owner to actual file in the library.

     

    However I found the issues that I had and this has already been sorted. Just giving the explanation below if someone has a similar problem.

     

    My two issues were I had some characters in the filenames as <<'>> and <<&>> that were impacting in the filter. So the ODATA query FileLeafRef eq 'Attachmentfilename' was not working when the filename was something like "James' Exam 1 & 2.pdf". 

     

    The other issue was simpler. I had more than 5000 files in the library so it was only taking the first 5000 items. It seemed to me that despite you have a filter query it is only considering the first 5000 items so I moved the excess (there were a few only) to a different library. 

     

    Hoe this can help to someone.

     

    Kind Regards

     

     

     

     

     

     

     

     

     

  • Sunshine14 Profile Picture
    11 on at

    Dear All,

    I have used get files( properties only) filter query to get attachments but I can only retrieve one attachment. I want to be able to get all attachments with the unique number whether it is in .txt, .pdf, .doc. When I run the filter query individually for these, it works fine but I am not able to get all the attachments with the unique number (with different document format) to be emailed in the next step. Please help

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 470

#2
Haque Profile Picture

Haque 411

#3
David_MA Profile Picture

David_MA 337 Super User 2026 Season 1

Last 30 days Overall leaderboard