Skip to main content

Notifications

Community site session details
Power Automate - General Discussion
Answered

How to delete a SharePoint folder using Power Automate

Like (1) ShareShare
ReportReport
Posted on 11 Jan 2023 22:10:17 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?

  • Suggested answer
    DB-20011720-0 Profile Picture
    4 on 07 Feb 2025 at 20:37:31
    How to delete a SharePoint folder using Power Automate
    @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.
  • Suggested answer
    CU03091917-0 Profile Picture
    26 on 03 Sep 2024 at 20:38:50
    How to delete a SharePoint folder using Power Automate
    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. 
  • simon19 Profile Picture
    3 on 20 Nov 2023 at 22:22:41
    Re: How to delete a SharePoint folder using Power Automate

    Thanks mate! 

  • NoName404 Profile Picture
    on 10 Oct 2023 at 06:04:35
    Re: How to delete a SharePoint folder using Power Automate

    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')
  • sheet0311 Profile Picture
    4 on 31 Jul 2023 at 08:07:24
    Re: How to delete a SharePoint folder using Power Automate

    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

  • _Judy_ Profile Picture
    91 on 21 Mar 2023 at 09:07:33
    Re: How to delete a SharePoint folder using Power Automate

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

    it's working

  • bafegles Profile Picture
    5 on 17 Jan 2023 at 12:54:05
    Re: How to delete a SharePoint folder using Power Automate

    Thank you! That worked perfectly!

  • Verified answer
    v-liwei-msft Profile Picture
    on 13 Jan 2023 at 06:38:04
    Re: How to delete a SharePoint folder using Power Automate

    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

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - General Discussion

#1
ankit_singhal Profile Picture

ankit_singhal 5 Super User 2025 Season 1

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 4 Super User 2025 Season 1

#3
David_MA Profile Picture

David_MA 2 Super User 2025 Season 1

Overall leaderboard