cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Kudo Collector
Kudo Collector

SharePoint 'Delete File' Action not working as expected

Hi,

 

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.

 

 

 

Delete Action.PNGDelete Error.PNGAny idea what is going on?

9 REPLIES 9
Highlighted
Community Support
Community Support

Re: SharePoint 'Delete File' Action not working as expected

Hi JRitmeijer,

 

Just created a flow following the steps in your article, I got the same error no matter what the File Identifier is.

 2.JPG

 

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.

 

Best regards,

Mona Li

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

Re: SharePoint 'Delete File' Action not working as expected

Hi,

 

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?

 

Highlighted
Frequent Visitor

Re: SharePoint 'Delete File' Action not working as expected

Hi, Did you ever find a solution to this? I have a similar problem where I am creating a .txt file purely for the purpose of creating a folder. When I go to delete the text file (as I only want to keep the folder path it has created) the file cannot be found. Even though I am using the exact same path that I used to create the file in the first place. Adding a delay does not help either.
Highlighted
New Member

Re: SharePoint 'Delete File' Action not working as expected

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.

 

Highlighted
New Member

Re: SharePoint 'Delete File' Action not working as expected

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

Highlighted
New Member

Re: SharePoint 'Delete File' Action not working as expected

Flow_Delete.gif

New Member

Re: SharePoint 'Delete File' Action not working as expected

Flow_Delete-2.gif

Highlighted
New Member

Re: SharePoint 'Delete File' Action not working as expected

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.

Flow_Delete-3.gif

Highlighted
Frequent Visitor

Re: SharePoint 'Delete File' Action not working as expected

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. 

Helpful resources

Announcements
Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Top Solution Authors
Top Kudoed Authors
Users online (7,528)