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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to delete a ShareP...
Power Automate
Unanswered

How to delete a SharePoint folder using Power Automate

(1) ShareShare
ReportReport
Posted on by

Hello! I have gone through a past thread about deleting folders from a library and tried all the options presented.

None of them work. 

I have:

  • Added an action to Get folder metadata using path
  • Populated the Folder Path field using the folder path field from the trigger step (When a file is created (properties only))
  • Added the action to Delete item
  • Entered the Library name in the list name field (the name of the library, not the URL name)
  • Populated the ID field with the ItemID from the Get folder metadata using path

 

It fails with a 400 status and tells me two fields (which are NOT part of the library that I can see) are not installed properly:

clientRequestID: GUID

serviceRequestID: GUID

 

I can't get my screen shot to load so I apologize for no images.

 

Is something missing or are there any other options to use to delete a folder?

Categories:
I have the same question (0)
  • Verified answer
    v-liwei-msft Profile Picture
    on at

    Hi @Anonymous 

     

    Flow does not provide an action to delete folders directly.
    You can delete folders using Send an HTTP request to SharePoint.
    I made a test for your reference:

    vliweimsft_0-1673591723967.png

    _api/web/GetFolderByServerRelativeUrl(‘/sites/YourSiteName/YourDocumentLibraryName/FolderName‘)

    I think this link will help you a lot:

    How-To #4: Delete Empty Folders in SharePoint Document Libraries Using Power Automate – Fausto Capellan, Jr

     

    Best Regards,

    Levi

  • bafegles Profile Picture
    5 on at

    Thank you! That worked perfectly!

  • _Judy_ Profile Picture
    95 on at

    Thank you sooooooo much😍 @v-liwei-msft , @Anonymous 

    it's working

  • sheet0311 Profile Picture
    4 on at

    Hi @Anonymous Delete Item works.  - You followed the right steps, just put Documents in List item and item Id from get metadata into the Id. It will work.

    I have tried the same, working for me. Thanks

  • NoName404 Profile Picture
    on at

    Don't know why this is marked as the solution is it will 100% not work. It doesn't even match MS's own (not working) documentation. According to MS no path should be required.

    https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest#working-with-folders-by-using-rest

     

    Anyway this should be simple but for whatever reason this is another thing in the endless list of things with powerautomate that take forever to figure out because of a lack of quality.

     

    Edit: In case anybody comes across this and has wasted two hours trying to figure out what the correct path is, this should work.

    _api/web/GetFolderByServerRelativeUrl('YourLibraryName/YourFolderName')
  • simon19 Profile Picture
    3 on at

    Thanks mate! 

  • Suggested answer
    CU03091917-0 Profile Picture
    26 on at
    Anyone have this or any form of folder deletion in SPO actually working?  100's of posts but no real answers, along with MS changes breaking what used to work. 
  • Suggested answer
    DB-20011720-0 Profile Picture
    4 on at
    @NoName404's and @v-liwei-msft's answer still works . . . 
    
    @CU03091917-0, you might have something wrong with your parameters in the "HTTP Request to SharePoint"
    
    As long as you specify "/sites/SiteName/FolderPath/FolderName" to the _api string inside the parentheses, it should work.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 523 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard