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 / Notification of docume...
Power Automate
Answered

Notification of documents older than X years - need help building Flow

(0) ShareShare
ReportReport
Posted on by 10

Hi friends,

 

I am new to Power Automate and need help building a flow that can notify me of documents (e.g., provide me with a list of documents in a Document Library) that are older than 2 years based on a custom date and time column I've created called "Last Reviewed". In this column, I only have dates entered, not times. I am finding flows that automatically delete/archive based on a time frame, but I want to review old documents, not delete them. Any help is appreciated! 

Categories:
I have the same question (0)
  • Verified answer
    efialttes Profile Picture
    14,756 on at

    Hi!

    Did you consider using 'Get files (properties only)' and an ODATA filter expression assigned to its Filter Query input?

    Assuming your column internal name is Last_x0020_Reviewed I would try with the following:

     

    -Add a 'Get past time' action block, assign as its value the expression utcNow, configure it to substract 24 months

    -Add a 'Get files (properties only)' with the following ODATA filter expression assigned to Filter query input

    Last_x0020_Reviewed lt '@{formatDateTime(body('Get_past_time'),'yyyy-MM-dd')}'

     

    Great stuff here

    https://baddaz.com/filtering-a-list-of-records-in-flow-based-on-todays-date-5a80292b366d

    https://sharepains.com/2018/11/12/sharepoint-get-items-odata-filter-query/

     

    Hope this helps

     

     

  • yinanrx Profile Picture
    10 on at

    Hi! Appreciate the help, but I'm still stuck... 😞

    When I ran the Flow, I received the following error:

    yinanrx_0-1601394822170.png

    And just for completeness sake, here is a screenshot of my Document Library:

    yinanrx_3-1601393299418.png

    Thanks again for your help!

  • efialttes Profile Picture
    14,756 on at

    Hi!

    Looks like single quotes are missing, I just highlighted them in red

    Last_x0020_Reviewed lt '@{formatDateTime(body('Get_past_time'),'yyyy-MM-dd')}'

    Hope this helps

  • yinanrx Profile Picture
    10 on at

    When I entered the expression that way, I receive the "expression is invalid" error... The only way it would accept it is this:

    formatDateTime(body('Get_past_time'),'yyyy-MM-dd')

     

    What am I doing wrong here?

  • yinanrx Profile Picture
    10 on at

    UPDATE: I got it to work this way (no @)...

    yinanrx_1-1601404315937.png

    But when I run the Flow, it's saying that it can't find my "Last Reviewed" column. It works if I used the "Modified" column instead. 

    At this point, it returns the output in syntax, I assume? I get this when I click on Outputs (click to download):

    yinanrx_2-1601404661155.png

     

    I assume I have to format this using more action blocks? Oof, I think I'm in over my head!

  • efialttes Profile Picture
    14,756 on at

    Hi!

    It seems your Sharepoint Internal column name is not 'Last_x0020_Reviewed' but something else.

    Two good tricks to figure out Sharepoint internal column name in this thread:

    https://powerusers.microsoft.com/t5/Building-Flows/Sort-in-GET-ITEMS-by-column-with-space/td-p/693964

     

    Hope this helps

  • yinanrx Profile Picture
    10 on at

    That's great - it did help me figure out the actual name of the column - thanks!

    Could you also point me to where I can convert the output to a readable file? Like I said previously, the output appears to be just code. How can I convert it to a list (e.g., spreadsheet) to be emailed to me as an attachment every time this Flow runs?

  • efialttes Profile Picture
    14,756 on at

    Hi!

    So the issue originally reported is finally solved, right? If so,

    Hurray! Great Job!

    Now on your new challenge. Next steps? My humble suggestion:

    1.-Mark this topic as "Solved" by clicking "Accept as a solution". THis way others facing a similar problem can find a solution faster. Please also note you can even select several responses as solution, even from different community members!

    Flow_AcceptSolution.png

    2.- Open a new thread for your new question, following the policy: 'One Question, one post'. This way you have more chances to attrack attention for superusers that are seeking for unanswered topics.

    3.- (OPTIONAL) Click on 'Thumbs up' in any answer you found valuable... or even in all of them 😉

    Flow_thumbsUp.png

    Even though this last step is OPTIONAL, please remember it is the cheapest, easiest way to say thanks to somebody that spent its time simply trying to help, specially on weekends. And just between you and me, everytime an inspiring answer receive a kudo in this community, an ewok escapes from The Emperor menace 

     

    Thanx for your help making this community great!

     

  • Jaylocks1990 Profile Picture
    3 on at

    Mate thanks so much, I know this thread is old but I have been banging my head against trying to nail the syntax for a get items ODATA filter right and this answer has got me over the line. Kudos to you! 

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 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard