Skip to main content

Notifications

Power Automate - Building Flows
Answered

Auto-delete items based on Modified date (standard format)

(0) ShareShare
ReportReport
Posted on by 300
Hi! I am trying to perform auto-delete items based on the Modified column (standard format) in SharePoint.
 
Items that are older than 4 weeks (28 days) should be deleted.
 
Am I missing something with my filter query? It could be some simple tweak I overlooked. Appreciate your help!
 
  • jaanihsm Profile Picture
    jaanihsm 300 on at
    Auto-delete items based on Modified date (standard format)
    My bad @Pstork1! It is working! I missed something on the code. Thank you so much for your time and support! 
  • jaanihsm Profile Picture
    jaanihsm 300 on at
    Auto-delete items based on Modified date (standard format)
    Hi @Pstork1! Appreciate the response!
     
    Unfortunately, I will need to include the filter for Status = Completed. I tried using AddDays(UtcNow(), -28) but it did not return any results from the query. What did you mean by test separately? Sorry, a bit of a newbie...
     
    I have a similar code for Status = Pending and EndDate eq AddDays(UtcNow(), -21, 'MM/dd/yyyy') and is working well (EndDate column was manually created vs Modified column from SharePoint default).
     
    So could be that my Modified date/time format in the query is wrong? Do you have another recommendation? Greatly appreciate it!
     
     
  • Verified answer
    Pstork1 Profile Picture
    Pstork1 64,703 on at
    Auto-delete items based on Modified date (standard format)
    Since the internal Dates will be stored in UTC format it would be better to use ISO 8601 utc format for the date when you are querying.  I would just do AddDays(UtcNow(), -28). You may also want to test the Status eq 'Completed' piece separately. Status is probably a choice column which is hard to query on.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,343

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,703

Leaderboard