cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Purman
Level: Powered On

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
6 REPLIES 6
Super User
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
Level: Powered On

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
Level: Powered On

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
Purman2
Level: Powered On

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

@ScottShearer 

 

Fantastic! Thank you, it's working!

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Users Online
Currently online: 47 members 4,580 guests
Please welcome our newest community members: