Skip to main content

Notifications

Community site session details

Community site session details

Session Id : /PRjLYJsgX9SvwF8TIHVQ+
Power Automate - Using Flows
Answered

Using Power Automate flow to delete all files and folders inside a sharepoint folder

Like (1) ShareShare
ReportReport
Posted on 11 Mar 2024 17:08:19 by 11

Hi all,

I've followed the steps in there to automate file deletion based on the creation dates.

Delete files from a sharepoint folder - Power Platform Community (microsoft.com)

However, folders are not getting deleted, If I dump all the files in one folder, and rerun the flow, all files get deleted without any issues.

That is the error "TobeDeleted/24-001 does not exist" I get which relates to one of the folders inside the main folder.

Any suggestions are welcome.

 

Thank you.

 

  • CU03091917-0 Profile Picture
    26 on 03 Sep 2024 at 20:16:20
    Using Power Automate flow to delete all files and folders inside a sharepoint folder
    Still fails
     
    You have to delete all the items in this folder before you can delete the folder.
    clientRequestId: c03de77e-a9da-427d-806e-
    serviceRequestId: 21bb4ca1-f065-6000-6667-
  • Verified answer
    jebz Profile Picture
    11 on 12 Mar 2024 at 11:48:22
    Re: Using Power Automate flow to delete all files and folders inside a sharepoint folder

    That worked perfectly, thank you so much.

  • Verified answer
    v-jefferni Profile Picture
    on 12 Mar 2024 at 09:10:34
    Re: Using Power Automate flow to delete all files and folders inside a sharepoint folder

    Hi @jebz ,

     

    To delete all contents from a folder, you can use the Delete item action. It's not supported to delete folders using Delete file action.

    vjefferni_0-1710234090592.png

     

    In Delete item action, you need to retrieve list name from Peek code in Get files action, copy table id and paste in the List name field in Delete item action:

    vjefferni_1-1710234443708.png

    vjefferni_2-1710234502021.png

    vjefferni_4-1710234565177.png

     

    Note that in Get file action, Include Nested Items needs to be false and in Delete file action it needs to use ID instead of Identifier.

     

    Best regards,

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,513 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,692 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow
Loading started