cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
JRitmeijer
Level: Powered On

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
Community Support Team
Community Support Team

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.
JRitmeijer
Level: Powered On

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?

 

hubertrobertson
Level: Powered On

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.
Sharkey
Level: Power Up

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.

 

Sharkey
Level: Power Up

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

Sharkey
Level: Power Up

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

Flow_Delete.gif

Sharkey
Level: Power Up

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

Flow_Delete-2.gif

Sharkey
Level: Power Up

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

hubertrobertson
Level: Powered On

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
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 51 members 3,304 guests
Please welcome our newest community members: