cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

How can I delete file from SharePoint library based on date column?

Hello,

 

I tried to create a flow which will delete the files in case of "Deletion" column's (date column) is less than today's date. I couldn't get it to work. I tried several ways, such as filtering if Deletion column is not empty but no success. Capture.JPG

 

How can I create a working flow?

1 ACCEPTED SOLUTION

Accepted Solutions

@Purman 

My mistake.....

Remove the 1 after le in the filter and you should be OK:

DeleteFile2.jpg

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

6 REPLIES 6
Dual Super User III
Dual Super User III

The key here is what you use as a trigger. For this kind of Flow you'll need a recurrence trigger that runs on a schedule, maybe once a week.  Then when it runs get all the documents in the library and process them with a ForEach loop.  in the loop do your comparison and delete the document if the deletion date is less than today.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Thank you for you answer. I use the once per week trigger. What should I modify to get it work? 

 

(Sorry, it's my secondary user) @Purman 

Super User III
Super User III

@Purman 

If you want to delete files with a date in the "Deletion" column less than or equal to today, try something similar to the following screen shot.

Please note:

  • There are single quotes around my expression in the filter query
  • I am assuming that you are using a recurrence trigger
  • In my expression I used le for less than or equal to.  You may want to use lt for less than instead

 

DeleteFile.jpgDeleteFile1.jpg

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

@ScottShearer 

 

Thank you for your answer! I had this error message:

 

"message": "The expression \"Deletion le 1 ' 2019-07-31'\" is not valid. 
 
What should I modify?

@Purman 

My mistake.....

Remove the 1 after le in the filter and you should be OK:

DeleteFile2.jpg

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

@ScottShearer 

 

Fantastic! Thank you, it's working!

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (20,194)