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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Delete files inside Do...
Power Automate
Answered

Delete files inside Document Sets which have folders and subfolders in a SharePoint Library

(0) ShareShare
ReportReport
Posted on by 4

Hello there!

 

I want to delete all files inside Document Sets which have folders and subfolders in a SharePoint Library when the status is "Closed".

Is it possible to do it with "Send an HTTP request to SharePoint"?

 

The flow runs "When an Item or File is Modified" and it creates a Document Set with multiple folders. When the document set is updated with a status of "Closed", it is moved to an "Archive library" and thus deleted from the "Source Library". It works perfectly in my Test environment, but unfortunately in Production it doesn't work, because there is a "Retention Policy" that means I have to delete all files/documents first before I can delete the folders and thus the Document Set

 

So I have been looking for several days now to find out a way how to deal with this.. Deleting first the files/documents and then deleting the Document Set is the way to go. I found some solutions, but it doesn't work in my case.

 

There is one which is quite close but I couldn't get it to work:  https://www.youtube.com/watch?v=LG8aFEutJyU 

 

The structure of my Document Library looks like this:

 

Library Name --> Document Set Name --> Folder --> File/Document 

 

Glad to hear from you.

 

Cheers.

 

M.

 

 

Screenshot 2024-01-07 at 21.32.55.png

Screenshot 2024-01-07 at 21.40.58.png

 

Categories:
I have the same question (0)
  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Malou,

    You need to select the Identifier parameter from the dynamic content to delete the file.

    To achieve this, you need to add a get file properties action before the Deletion file action, then Delete the file through the File Identifier property from the get file properties action.

    vqiaqimsft_0-1704675000895.png

     

  • Malou Profile Picture
    4 on at

    Thank you for taking your time @v-qiaqi-msft.

    The ID of Get Files properties, how did you get it?

     

    Thanks.

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Malou,

    Since you have a Filter array after yout Get items action, you need to select the ID from the filter array as below:

    vqiaqimsft_0-1704713866460.png

    item()?['ID']
  • Malou Profile Picture
    4 on at

    Unfortunately, it did not work. I get an error which says "The file does not exist".

    In the last step "Delete file" it does not find the file. Is there where the error shows.

    I follow your advice, so I really do not know where the error lies.

     

    Again: 

    The structure of my custom library looks like this:

    Library Name --> Document Set Name --> Folder --> File/Document

     

    Please, look at the image below, perhaps can help to understand where the issue lies. 

     

    WFRes.jpg

     

     

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 959

#2
Valantis Profile Picture

Valantis 872

#3
Haque Profile Picture

Haque 589

Last 30 days Overall leaderboard