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 :
Power Automate - Building Flows
Unanswered

Submit Sharepoint files for reapproval after a period of time

(0) ShareShare
ReportReport
Posted on by 5

Hi,

 

I'd like to build a scheduled flow which monitors the contents of a Sharepoint document library. If a file has been approved but not modified in the last 12 months (for example), I would like the flow to re-submit the file for approval. This seems pretty basic and straightforward to me, but I can't get it working, so I must be missing something obvious.

 

The below is my current flow. (I'll switch the trigger to a scheduled flow once I've got it working.)

 

PA re-submit flow.png

 

The condition is "getPastTime(1, 'Day')" (again, this will be updated to 12 months once testing is complete) but this flow in its current setup gives me the following error message:

"The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@items('Apply_to_each_2')?['Modified']' is of type 'String'. The result must be a valid array."

 

Please help!

I have the same question (0)
  • v-wenjuan-msft Profile Picture
    Microsoft Employee on at
    Re: Submit Sharepoint files for reapproval after a period of time

    Hi,

     

    You can get present timestamp and substract a period of time(like 365 days) from it, and then you can compare it with file's modified timestamp.

     

    Here are functions I used in my test:

     

     

    first(split(item()?['Modified'],'T'))
    
    formatdatetime(adddays(convertFromUtc(utcNow(),'China Standard Time'),-365),'yyyy-MM-dd')

     

     

    vwenjuanmsft_0-1680515783733.png

     

    Best regards,

    Wenjuan Zou

  • PBW Profile Picture
    5 on at
    Re: Submit Sharepoint files for reapproval after a period of time

    Thank you, my flow now runs successfully, but is taking a very long time. I only have 11 files in the document library and after an hour the flow hadn't updated the first one. Do you have any ideas why this might be?

  • v-wenjuan-msft Profile Picture
    Microsoft Employee on at
    Re: Submit Sharepoint files for reapproval after a period of time

    Hi @PBW ,

     

    You can check your flow run history to check which action was the flow stuck on.

    Please attach screenshots here if possible.

    Thank you!

     

    Best regards,

    Wenjuan Zou

  • PBW Profile Picture
    5 on at
    Re: Submit Sharepoint files for reapproval after a period of time

    Thanks @v-wenjuan-msft, it's getting stuck on the final stage. I took your advice and created the two functions. After the first slow run I moved the following function out of the Apply To Each step in the hope that it would only be evaluated once and might speed things up. 

    formatdatetime(adddays(convertFromUtc(utcNow(),'China Standard Time'),-365),'yyyy-MM-dd')

     

    As you can see below, it hasn't worked for me!

    PA re-submit flow slow runnig.png

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…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 788 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 452 Moderator

#3
developerAJ Profile Picture

developerAJ 302

Last 30 days Overall leaderboard