Skip to main content

Notifications

Community site session details
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.

 

  • 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,

  • 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.

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 - Using Flows

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 7 Super User 2025 Season 1

#1
rzaneti Profile Picture

rzaneti 7 Super User 2025 Season 1

#3
CU20032117-0 Profile Picture

CU20032117-0 4

Overall leaderboard

Featured topics

Restore a deleted flow
Loading started
Loading started
Loading complete