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 / How can I delete file ...
Power Automate
Answered

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

(0) ShareShare
ReportReport
Posted on by 42

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?

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    68,739 Most Valuable Professional on at

    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.

  • Purman2 Profile Picture
    9 on at

    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 

  • ScottShearer Profile Picture
    25,270 Most Valuable Professional on at

    @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

  • Purman Profile Picture
    42 on at

    @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?
  • Verified answer
    ScottShearer Profile Picture
    25,270 Most Valuable Professional on at

    @Purman 

    My mistake.....

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

    DeleteFile2.jpg

  • Purman2 Profile Picture
    9 on at

    @ScottShearer 

     

    Fantastic! Thank you, it's working!

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…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard