I am working on a workflow that moves files between site collections (See this blog post). This is all working fine except the last step where I delete the file that triggered the flow.
Using the 'file path' variable, or manually entering the path always results in a '404 Resource not found' error. When using Flow's 'browse' button to select the file to delete it tends to work fine.
No matter how I specify the path (manually, browser or variable) it always displays the exact same path and file name. The error message confirms the exact path it tried to delete.
For details see the screenshots below.
Any idea what is going on?
Just created a flow following the steps in your article, I got the same error no matter what the File Identifier is.
May I know which file are you trying to delete? My understanding is that you want to delete the file in the first site collection with the trigger “When a file is created”, but since when you create this flow, the file is not even created or exsit, you cannot specify one file in this action. So this requirement cannot be achieved.
I believe your assumption is correct, I am trying to delete the file that triggered the workflow in the first site collection.
You make a very important point here. Is the Flow triggered BEFORE the file is created and the file will not be created in SharePoint until the Flow finishes, so there is nothing to delete?
If that is the case, why does it work - at least intermittently - when I use the Browse function to specify the file to delete (the file is there at design time, but I delete it before I trigger the Flow)
Also, I just added a 1 minute delay before the delete action. I see the file being created, the flow is still running (or at least waiting) at that time, but even though the file exists, I get the same error as part of the Delete action.
Regardless of what is going on, how can I reliably delete the file that triggered the workflow?
This works for me. You can't use wildcards in the file name. It has to match exactly. Instead of using 'File Identifier'
Place a file in the folder with the same name before you set up the Flow. Then when you add the Delete task, you will drill down to it. I tried to add a screen shot, but it didn't work.
A file with that name has to exist in the folder before you set up the Flow task so you use the Folder icon to drill down to the file and select it. It will appear in the 'File Identifier' field something like this: /Documents/Outbound/filename.txt
Sorry for the confusion but I grabbed a screen shot showing it from scratch. Click in the file name once you get to the folder. and it will populate the field.
Had similar problem. If your flow is trying to delete a file it itself deleted try just create a second flow for the delete action. Worked for me. Use the filename as a filter.