cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sam4
Resolver I
Resolver I

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

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

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

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

 

 

 

 

 

 

 

 

 

View solution in original post

2 REPLIES 2
v-bacao-msft
Community Support
Community Support

 

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,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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

 

 

 

 

 

 

 

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (1,722)