web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Deleting folder with c...
Power Automate
Unanswered

Deleting folder with contents using 'Send an HTTP request to SharePoint' suddenly failing

(0) ShareShare
ReportReport
Posted on by 10
Hi,
 
I have been using "Send an HTTP request to SharePoint" with the below details to delete a folder and all of its contents in one action for over 9 months now. Two weeks ago, this started failing with message that the folder needs to be empty before it can be deleted. Any ideas/workarounds to make this operational again without having to delete all files in all subfolders prior to deleting the parent folder/s?
 
Current details (specific uris replaced with generic names):
 
Send an HTTP request to SharePoint
Method: DELETE
Uri: _api/web/getFolderByServerRelativeUrl('/sites/SITENAME/Shared Documents/FolderName/DeleteThisFolder')
Headers:
  Prefer: bypass-shared-lock
 
Failed message:
message": "BadGateway"
"status": 502
"message": "You have to delete all the items in this folder before you can delete the folder...."
 
Thanks for the help!
Categories:
I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 378

#2
Valantis Profile Picture

Valantis 329

#3
David_MA Profile Picture

David_MA 283 Super User 2026 Season 1

Last 30 days Overall leaderboard