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

Delete Folder in SharePoint via HTTP Action?

Is it possible to delete a folder in a SharePoint document library via the HTTP Request action?  I've been able to successfully create folders with the HTTP action, but I can't figure out how to use the same functionality to delete empty folders.  

 

Any help working out the syntax would be very much appreciated.  Thank you. 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Delete Folder in SharePoint via HTTP Action?

Hi @rjhale,

 

You could try to implement your needs using the existing action of the SharePoint connector.

Use Get files(properties only) to get all the files (including folders).

Configure Filter array to filter out the folders contained in the specified folder.

48.PNG

Use List folder to list the files and folders contained in the folder.

If the length of the output body is equal to 0, then this folder is an empty folder.

This folder can be deleted by configuring the corresponding ID.

Expression:

items('Apply_to_each')['{Identifier}']

length(body('List_folder'))

items('Apply_to_each')['ID']

49.PNG

When doing the test, it is recommended to create new folders and files to avoid accidental deletion of files.

Please take a try.

 

Best Regards,

Barry

 

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

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Delete Folder in SharePoint via HTTP Action?

Hi @rjhale,

 

You could try to implement your needs using the existing action of the SharePoint connector.

Use Get files(properties only) to get all the files (including folders).

Configure Filter array to filter out the folders contained in the specified folder.

48.PNG

Use List folder to list the files and folders contained in the folder.

If the length of the output body is equal to 0, then this folder is an empty folder.

This folder can be deleted by configuring the corresponding ID.

Expression:

items('Apply_to_each')['{Identifier}']

length(body('List_folder'))

items('Apply_to_each')['ID']

49.PNG

When doing the test, it is recommended to create new folders and files to avoid accidental deletion of files.

Please take a try.

 

Best Regards,

Barry

 

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

View solution in original post

rjhale
Level: Powered On

Re: Delete Folder in SharePoint via HTTP Action?

Wow. That worked!  The only change I had to make was to use the document library ID in the List Name property of the Delete Item step.  I tried using the name of the document library as a custom value, but I kept getting 404 errors. 

 

Thank you very much for the detailed write up on how to get to the correct solution.  I really appreciate the help. 

 

 

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: 359 members 2,787 guests
Please welcome our newest community members: