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

SharePoint - Delete file

I am having trouble deleting files from SharePoint. I get a 404 error but I am certain it is pointing to the right file.

I first thought it must have been a typo but after running Update file, which executes just fine this seems to be a bug with Delete File.

 

The process is as follows:

- Task with TaskID is completed

- Get row gets the row with TaskId, this row has a field called Subject

- Subject is the filename of the file to be deleted

- Delete file deletes the file - this is where it errors out

 

See screenshots for flow configuration and error message:

 

Thanks a lot.

Lukas

201907081216181lukask.png201907081217050lukask.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: SharePoint - Delete file

Hi again

The file you update is the same you want to delete, right?

If so, I have just tested it successfully by using an output from "Update file", see the following screenshot

Flow_delete_file.png

Hope this helps





If anybody solved your question, remember to mark its post as a solution!

Proud to be a Flownaut!





View solution in original post

6 REPLIES 6
lkaspar
Level: Powered On

Re: SharePoint - Delete file

Sorry for double post - I can't seem to figure out how to edit a post.

 

Here is the image of the error message:

 

201907081238808lukask.pngError Message

Super User
Super User

Re: SharePoint - Delete file

@lkaspar 

I guess the problem is with the File identifier you are using as input for SP DElete file action block.

I would suggest to add a "Compose" action block between "Update file" and "Delete file" and add "Path" (the one you are using for "Delete File") as input of the Compose action block, so you can inspect the content of its value

Hope this helps

 





If anybody solved your question, remember to mark its post as a solution!

Proud to be a Flownaut!





Highlighted
Super User
Super User

Re: SharePoint - Delete file

Hi again

The file you update is the same you want to delete, right?

If so, I have just tested it successfully by using an output from "Update file", see the following screenshot

Flow_delete_file.png

Hope this helps





If anybody solved your question, remember to mark its post as a solution!

Proud to be a Flownaut!





View solution in original post

lkaspar
Level: Powered On

Re: SharePoint - Delete file

Thanks for the swift response!

 

The only reason I had the update file action in there was to test the file identifier.

 

I tested your solution of using the Id of the Update file action and it worked. I don't know how because when I used the compose function after the update file, the file path was correct but Delete File failed. When I copied the output of compose and manually entered it in the File Identifier field, it worked. I think the problem is with the Subject variable coming directly from Get a row.

 

I will mark your solution as accepted but I think there is a bug in Delete file.

 

Thank you for your help

Super User
Super User

Re: SharePoint - Delete file

@lkaspar

I agree, for some strange reason, values accepted as input for File Identifier in some action blocks are not valid in other related action blocks.

In the meantime, happy to see we found a reasonable workaround!





If anybody solved your question, remember to mark its post as a solution!

Proud to be a Flownaut!





Sub
Level: Powered On

Re: SharePoint - Delete file

Hi @lkaspar 

The File Identifier field in the Delete file Action uses URI so if you have to change the '/' after the libaray name to 

%252f

So in your case i would use the Identifier field from your Update File action or if you know the filename in your case you do if should be:

Shared Documents/General/Emails/[Subject].msg

  • Shared%20Documents%252fGeneral%252fEmails%252f[Subject].msg
[LibarayName]%252f[Filename].[extension]

 image.png

You can also use the uriComponent() expression to turn you value into a URI value

image.png

 

Hope this helped.

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: 63 members 3,496 guests
Please welcome our newest community members: