cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Purman 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
Super User
Super User

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

@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
Dual Super User

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

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.
Purman2
Frequent Visitor

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

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 

Highlighted
Super User
Super User

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

@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
Purman Helper I
Helper I

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

@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?
Super User
Super User

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

@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

Purman2
Frequent Visitor

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

@ScottShearer 

 

Fantastic! Thank you, it's working!

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (6,759)