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
Dual Super User
Dual 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 anyone is trying to help you with an issue, the fastest way to say thanks is by kudoing. Be grateful, Thumbs up!

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

Dual Super User
Dual 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 anyone is trying to help you with an issue, the fastest way to say thanks is by kudoing. Be grateful, Thumbs up!

Proud to be a Flownaut!





Dual Super User
Dual 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 anyone is trying to help you with an issue, the fastest way to say thanks is by kudoing. Be grateful, Thumbs up!

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

Dual Super User
Dual 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 anyone is trying to help you with an issue, the fastest way to say thanks is by kudoing. Be grateful, Thumbs up!

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
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

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 Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (6,186)