Attached is a copy of a 'Delete All' Flow template from Power Automate. How do I modify this Flow so that it ONLY deletes the file being updated in the Library rather than all files in the Library.

I have a PowerApps button I use to Update data on a List and the documents in a Library. I need the original document (based on the 'CQUnqID' I created - and that exists in the List and Library), deleted in the Library so that the new document only is left in the Library.

enter image description here

  • Did you try exiting after the first iteration? Try adding a Terminate action May 13, 2021 at 21:55

1 Answer 1


One option could be to add a filter query to your Get Files (properties only) action.

Press the "Show advanced options" button and in the Filter Query field, try something like

QCUnqID eq id

There is probably a better way but I think I'd need to see the full flow to offer further suggestions. For me, it really comes down to how you're identifying the CQunqID value.


After reading your comment and some of your other posts, I'm thinking you could Set your patch to a variable and use that variable to pass the CQUnqID to the Flow.

So your flow would use PowerApps as a trigger and your Get Files action would have a filter query like "CQUnqID eq Ask in PowerApps"

Your PowerApps button's On Select would look something like:

Set( varLastSubmit, Patch( collList, { Title: "Words", CQUnqID: 12345 } ) );


  • Thank you for the reply. I do believe that what you hit upon is what I'm looking for; though, I need to make sure it is clear that the Item/File I want deleted in the Library is ONLY the file with the new file's 'CQUnqID'. Is there a way to make the Filter Query know and understand to ONLY push the 'CQUnqID' for the newly uploaded data/document and the Filter Query should ONLY look for and act upon document in the Library where the 'CQUnqID' in the PowerApps upload is equal to the 'CQUnqID' in the Library? May 13, 2021 at 22:06
  • I've just had a quick look at some of your previous posts/chat and saw this: " I have a PowerApps button that has two actions - Patch to the List (including the 'CQUnqID') and upload the document. " So the first thing your button does is something like Patch(List, {Title: "Words", "CQunqID: 11111})? Perhaps set it to a variable like Set(varLastSubmit, Patch(List, {Title: "Words", "CQunqID: 11111})) and then your second step uses varLastSubmit.CQunqID
    – user79408
    May 13, 2021 at 23:26
  • Thank you for the input; I apologize for the delayed response. I actually figured another way around; though, again, thank you for the work! May 26, 2021 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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