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 / Itterate a document li...
Power Automate
Answered

Itterate a document library

(0) ShareShare
ReportReport
Posted on by 3

Hi there group,

 

I'm trying to help a co-worker with a "problem" she has:

 

She has a list of contracts which will eventually expire. So I made her a document library (so she can store the digital version of the contract), added some extra columns for expire date, contract owner and such, and made a calender view for her. Allready looks pretty neat for her having the files show up on a calendar, based on expire date.

 

What I kinda promised her (foolish me) was to add logic that would "do something" (send out an email or something) whenever a contract expires or is about to expire. I was thinking about a sheduled flow itterating the library, comparing some dates to trigger an action.

 

But I immediatelly ran into trouble trying to make that flow: I can't find a function to itterate a document library. To be honest... I don't have a whole lot of experience with Flow. Do most of my work with Perl (yeah I know... old skool)

 

To get to the point.... please give your thoughts on:

- Is flow the right tool for this job.

- How should I go about doing this (a rtfm (with pointer) is greatly appreciated since this is a learning experience for me)

- Is the Flow portal the only way to make flows? Or can you use an IDE like Visual Studio this.

 

With kind regards,

 

Peter

Categories:
I have the same question (0)
  • Verified answer
    RobElliott Profile Picture
    10,323 Super User 2025 Season 2 on at

    Hi Peter @PeterKaagman , Flow is certainly the tool for this job and it works very well on a document library. I believe you might be able to achieve something with InfoPath but I wouldn't as it's not being developed and is not the future. We have Flow which is great for just this sort of thing.

    One of the things with Flow is that when you do the initial recurrence trigger and the the Get items action the dropdown doesn't show you the document libraries, it only shows the list. But you can type in the name of your document library and select to use it as a custom value. I have a flow running to remind the document "owner" that a review is due in 2 days and then if they don't review it a second email goes out on the actual date of the review. The steps for this are as follows with screenshots further down.

     

    1. Add a recurrence schedule as your trigger. In image 1 below I've set that to run once a day at 9am.
    2. Add a get items action. In my list I am holding the review date in a column called NextReview which is a DateTime column with a default value of 6 months ahead.
      In image 2 I've set the filter query to NextReview ne null as it's running on an existing list and some older items don't have a NextReview date and we don't want the Flow to fail because of this, so we ignore those that don't have a NextReview date.
    3. Add an Apply to each and select value from the dynamic content over on the right.
    4. Add a Compose control to get the date 2 days ahead using the expression 
      adddays(utcnow(),2,'yyyy-MM-dd')
      We're using that format to make sure the NextReview date from the list and the Compose control are in exactly the same format. Make sure you use capitals for the month. Later on we'll change the date format to (in my case) UK format.
    5. Add another Compose control to get today's date using the expression
      utcnow('yyyy-MM-dd')
    6. Add a Condition control to check if the output from the Compose control looking 2 days ahead is equal to the NextReview date. On the left hand side of the condition add the Output from the Compose and on the Right select the NextReview column from the dynamic content.
    7. If Yes, add a date control and select Convert time zone. In the Base time box select the SharePoint NextReview column from dynamic content. Enter the date format, in my case it's dd/MM/yyyy.
    8. Still on the If Yes side, add aa Send an Email (v2). The To box will hold the email address of the reviewer.  The Subject box is  "Document Review due in 2 days". In my example we have several reviewers so there is a column in the list for the reviewer'. As part of the body select the Output "Converted time" from the dynamic content so the email shows the date in the corect format. Add any other info you need in the email.
    9. On the If No side of the condition (the NextReview date is not 2 days ahead) , add another Condition control to check if the Output of the second Compose is equal to today. So the lef thand side has the Output and the right hand side has the NextReview column from dynamic content.
    10. If it is, add a Convert time zone as you did in step 7 above.
    11. Add another Send an Email (v2) with the same info except that the title is "Document Review due today". In my example I've added a link to the view of the list where the reviews assigned to that reviewer are displayed.
    12. The emails that come in show the the NextReview date either for 2 days ahead or for today depending on when the next review is due.

    The screenshots of the steps are below.

    Rob
    Los Gallardos

    1-Recurrence1-Recurrence2-Get items2-Get items3-Apply to each3-Apply to each4-Compose 2 Days4-Compose 2 Days5-Compose Today5-Compose Today6-Condition 2 Days6-Condition 2 Days7-Convert time zone7-Convert time zone8-Compose an email 18-Compose an email 19-Output Today9-Output Today10-Compose an Email 210-Compose an Email 211-My reviews11-My reviews12-Emails12-Emails

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

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard