0

I want to create a flow that will replace the existing file if a new one is copied into the library even if the name has been slightly changed i.e.

Current saved file name in SharePoint: BSP5C1234 - Box - CBOX123 - Rev01

New File name that will be automated in: BSP5C1234 - Box - CBOX123 - Rev02

As you can see from the example, I am mostly interested in the last 2 digits.

I am not sure if this is even possible or how to go about it.

Many thanks, Artur

2 Answers 2

0

you may not be able to replace the file but you can add a check to see if the file with a given name exists using Get File properties, if it does use Update File action to just update the content inside file. Its as good as replacing file unless you have some business critical rule which don't allow you to do so.

0

Here is a workaround: The process to “replace” a document with a new created one would be:

  1. Trigger the flow on a new created document
  2. Get the files properties from the library
  3. If flow finds a filename containing specific substring, it deletes the source file and keep the new created one.

Sample flow:

enter image description here

2
  • Hi Chelsea_MSFT, Thank you for this. Just a few questions, how do i put the apply each in a Query? Also, if i wanted to do the check on any file upload apart from the example used (BSP5C1234 - Box - CBOX123 - Rev) how can i go about it? As, the idea is that there will be multiple documents uploaded with different file names that will require the same review. Many thanks, once again.
    – ArturDj
    Aug 21, 2020 at 13:46
  • @ArturDj To answer your questions: 1. The “Apply to each” action is automatically added by Flow if it detects that the following actions need to be applied to all files in this depository. 2. Sorry that that is something I have not been able to sort out. I've tried to use Flow String functions (such as "substring") but the flow keeps giving me error. So if you can take a look and see if this is workable, that would be good. Reference here: docs.microsoft.com/en-us/azure/logic-apps/… Aug 24, 2020 at 2:01

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.