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 / Delete Folder Sharepoi...
Power Automate
Answered

Delete Folder Sharepoint ?

(1) ShareShare
ReportReport
Posted on by 91

Hello everyone ,

There is a way to delete a folder in a SharePoint library with MS Flow ? I can delete files insides the folder but i'm not able to delete the folder. 

 

Thank you for your feedback ! 

 

 

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

    Hi charafRef,

     

    Currently, Flow has an action that can be used to “Delete file” in a folder, but there is no action “Delete folder” can be used to delete a folder in SharePoint library.

    On the Flow Ideas Forum, there is no similar request, please consider submit a new idea at here, I will help collect and report it on my side:
    https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

     

    Best regards,
    Mabel Mao

  • WonderLaura Profile Picture
    50 on at

    You can use the SharePoint "Delete item" action instead of delete file.  Just type in the name of your library as a custom value in the list picker drop-down in the action.

  • rjhale Profile Picture
    212 on at

    @WonderLaura.  Could you explain how that would work?  It looks like I need to provide the List Name and ID of the object.  I'm not sure what I would put in either of those fields given that I'm trying to delete a folder out of a document library.  

     

    I also tried using the HTTP post, but ran into problems with that approach as well.  I get an error message stating 

    "The type SP.FolderCollection does not support HTTP DELETE method.\r\nclientRequestId:"  I wonder if I'm not allowed to use the api call to delete folders out of a SharePoint librarary?  
     
    Any help would be much appreciated.  Thanks. 
  • magikbus Profile Picture
    61 on at

    @rjhale  I was able to get @WonderLaura's suggestion to work. You need to use the get folder metadata action to get the folder Id, then when you use the delete item action select the site address, enter the library name as a custom value, and then select the ItemId option from the Get Folder Metadata action.

  • rjhale Profile Picture
    212 on at

    @magikbus  Yeah.  I believe we did get this to work in our environment.  Thanks for asking. 

  • rjhale Profile Picture
    212 on at

    @magikbus  Yeah.  I believe we did get this to work in our environment.  Thanks for asking. 

  • shawnfielding Profile Picture
    12 on at

    So close, but I am not able to get the folder to delete.  I keep getting a 404 List not found when I use the custom value for list.  I am able to get the ID of the folder I want to delete.  And the folder name is correct in the list name field.

  • SoniaGr Profile Picture
    22 on at

    Hi @shawnfielding,  you need to use the Library Name in the list name field not the folder name!

  • andeeh1974 Profile Picture
    19 on at

    Anyone have a visual example for this?

  • magikbus Profile Picture
    61 on at

    Screen captures are such a pain in these forums.

     

    First thing you need to do is create a trigger from the SharePoint library. Whether that is a manual trigger, on create or modify trigger. Then you need to add the "Get folder metadata" SharePoint action to your flow. In that action select the site address, and enter the "Folder Path" from the tigger action.

     

    Then once you have completed all other actions and you are ready to delete the folder. Insert the "Delete Item" SharePoint action into the flow. Again set the site adress. In the List Name field click the drop down arrow. You will only see your SharePoint list names show in the drop down, but at the bottom of the list you will see an option for "Enter custom value". Type in the name of your SharePoint Library. Then in the Id field select the "ItemId" field from the Get folder metadata action. And that's it. Hope this helps

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…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 339 Super User 2025 Season 2

#1
trice602 Profile Picture

trice602 339 Super User 2025 Season 2

#3
David_MA Profile Picture

David_MA 270 Super User 2025 Season 2

Last 30 days Overall leaderboard