web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : aEA/DTcn2txFrKLsmAyNBA
Power Automate - Building Flows
Answered

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

Like (0) ShareShare
ReportReport
Posted on 17 Sep 2020 18:47:32 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! 

I have the same question (0)
  • Jaylocks1990 Profile Picture
    3 on 23 Jun 2022 at 05:12:37
    Re: Notification of documents older than X years - need help building Flow

    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! 

  • efialttes Profile Picture
    14,756 on 30 Sep 2020 at 15:52:21
    Re: Notification of documents older than X years - need help building Flow

    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!

     

  • yinanrx Profile Picture
    10 on 30 Sep 2020 at 14:48:48
    Re: Notification of documents older than X years - need help building Flow

    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 30 Sep 2020 at 07:37:40
    Re: Notification of documents older than X years - need help building Flow

    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 29 Sep 2020 at 18:38:09
    Re: Notification of documents older than X years - need help building Flow

    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!

  • yinanrx Profile Picture
    10 on 29 Sep 2020 at 17:26:52
    Re: Notification of documents older than X years - need help building Flow

    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?

  • efialttes Profile Picture
    14,756 on 29 Sep 2020 at 16:05:21
    Re: Notification of documents older than X years - need help building Flow

    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 29 Sep 2020 at 15:28:59
    Re: Notification of documents older than X years - need help building Flow

    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!

  • Verified answer
    efialttes Profile Picture
    14,756 on 17 Sep 2020 at 20:05:34
    Re: Notification of documents older than X years - need help building Flow

    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

     

     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading complete