Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Delete 'Archived' Item after Five Years

(0) ShareShare
ReportReport
Posted on by 4,941 Super User 2025 Season 1

I have a recuring flow that is to delete items that are five years old with a status of 'Archived'.

Will the following Get Items Filter Query get the items I'm looking for?

     (Status eq 'string('Archive')' and 'Created eq 'string(formatDateTime(utcNow(),5))'

  • lumberjacklurch Profile Picture
    435 on at
    Delete 'Archived' Item after Five Years
    Thank you both for this thread.  I used the expression below, but I am getting the below error:
     
    Action 'Get_old_records' failed: The expression "Modified le 10-24-2019" is not valid. Creating query failed.
     
    My expression is almost identical the one verified to work:
     
    Modified le 'addToTime(utcNow(),-5,'Year','MM-dd-yyy')'
     
    The date column I'm checking against is using the standard format.
     
    What am I missing?
  • Phineas Profile Picture
    4,941 Super User 2025 Season 1 on at
    Re: Delete 'Archived' Item after Five Years

    Will the below return ONLY both status identified that are seven or more days old?

    Get Items Filter Query -
    (Status eq 'string('Minutes Approved') or (Status eq 'Minutes Pending') and (Modified le addToTime(utcNow(),-7,'Days','yyyy-MM-dd')

  • Verified answer
    ScottShearer Profile Picture
    25,228 Most Valuable Professional on at
    Re: Delete 'Archived' Item after Five Years

     

    I am assuming the the items are in a SharePoint list.

    It depends on the internal names of the columns, but the following should

    Status eq 'Archive' and Created le 'addToTime(utcNow(),-5,'Year','yyyy-MM-dd')'

     

    Obviously, the addToTime expression must be entered in the expression window.

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >