1

I have two document libraries, one for working documents (word, excel, etc...) and one for published documents (pdf's). I have created a Flow to convert the document to pdf. Generally, it works. However, in order to update an existing (i.e. checked in) pdf, it must be checked out before the new file is created (no different than attempting so manually). So, when I run the Flow with a selected document in the working library, I need it to check out the corresponding (same named) document in the published library.

Here's the general flow:

Flow

I have tried two approaches to filtering the Get files step using the Filter Query.

Query 1: Name eq SOG_5000_001.docx
Output: { "status": 400, "message": "Column 'Name' does not exist. It may have been deleted by another user.}

Query 2: FileLeafRef eq SOG_5000_001.docx
Output: { "status": 400, "message": "Column 'SOG_5000_001.docx' does not exist. It may have been deleted by another user.}

EDIT: to clarify, the value 'SOG_5000_001.docx' is not hard-coded. Rather, it is the result of dynamic content from the Get file properties step.

I have confirmed that both documents have the same name (FileLeafRef) in their respective libraries. However, I cannot figure out why it errors rather than filtering for the single desired value.

FINAL: One other issue that I didn't realize initially was that I needed to compare 'SOG_5000_001.docx' to 'SOG_5000_001.pdf' because I wanted to use the word document name to determine the pdf document to check out. So, my final Filter Query is startswith(FileLeafRef,'Name') and I don't have to worry about file types at all.

1

You need to wrap the value in single quotes 'SOG_5001_001.docx' when using an odata filter, whether in a Flow or otherwise. Without the quotes, it thinks you are trying to compare two different columns together, rather than a column to a constant string value.

So, your filter would look like FileLeafRef eq 'SOG_5001_001.docx'

These single quotes would still need to be in your flow step even if the parameter value is being dynamically passed from a Flow variable or value returned from previous step. See the screenshot below where I used a value from the triggerBody() as my dynamic input, though it could be any other valid Flow expression, but I hand-typed the single quotes around the dynamic value:

enter image description here

2
  • 1
    Based on your edit that "the value 'SOG_5000_001.docx' is not hard-coded", I would point out that if you are concatenating a retrieved value to generate the filter parameter in your Flow step, you still need those single quotes. In the designer window in Power Automate would look something like FileLeafRef eq '[valuefrompreviousstep]' – willman Jan 21 '20 at 14:08
  • That was exactly what I needed. I assumed that since I was pulling in dynamic content, I wouldn't need quotes. But I didn't consider that concatenating the file type would throw it off. Thanks for the help! – dav Jan 21 '20 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.