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 / Flow to read calendar ...
Power Automate
Answered

Flow to read calendar events and create an event based on conditions

(0) ShareShare
ReportReport
Posted on by 8

We currently have a calendar that needs to be blocked automatically when it reaches a certain number of events.  Here is what I need it to do:

  • Read the calendar
  • Check the number of events each hour (events can be scheduled every hour on the hour between 8am and 2pm)
  • If the number of events is greater than 6 per hour, I want to automatically create an event that same hour called "Lab Full."
  • If the number of events is less than 6, I want to continue reading the calendar until it finds another instance of 6 events in an hour.

Below is what I've been able to accomplish in Power Automate.

swhanneman_0-1710527352503.png

I'm struggling with the required start and end time as it's contingent upon a particular hour.  For example, the event, "Lab Full" should be created when an hour reaches six events.

Here is how my condition is set up.

swhanneman_1-1710527473434.png

If true, I have my flow set to create the "Lab Full" calendar event.  If false, I have the Do until condition here.

swhanneman_2-1710527590997.png

In both examples, labBooking is an object.

Please let me know if you can offer any guidance.  I'm happy to answer any follow up questions or provide clarification.  Thanks in advance!

 

 

Categories:
I have the same question (0)
  • Nived_Nambiar Profile Picture
    18,136 Super User 2025 Season 2 on at

    Hi @swhanneman 

     

    One question - does this flow is supposed to run every hour (start of the hour ) and check for that hour whether the events exxecded >6 or not right ?

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

  • swhanneman Profile Picture
    8 on at

    Yes, that's correct.  If the flow can check more frequently every hour that would be beneficial.  The events occur every hour on the hour specifically (events are always 8am, 2pm, etc.).  Does the flow need to account for the event start and end times?  We currently have events running 8am to 3pm Monday through Friday.

  • Nived_Nambiar Profile Picture
    18,136 Super User 2025 Season 2 on at

    Hi @swhanneman 

     

    see this flow design 🙂

     

    You can create a recurrance flow which triggers with an interval of every 1 hour 

    Nived_Nambiar_0-1710781075473.png

     

    You can set from which time it should start the flow in advanced sections of recurrance flow settings

    Nived_Nambiar_1-1710781247465.png

     

    Next write a expression which stores the current time > which is start of hour 

    Nived_Nambiar_2-1710781287219.png

     

     

    Filter the calendar events by using start and end time like below

    Nived_Nambiar_3-1710781340163.png

     

    Nived_Nambiar_4-1710781359562.png

     

    Expression - addHours(outputs('Compose-StartTime'),1)

     

    Use below condition to check whether the number events obtained as output from the above action is greater than 6 ?

    Nived_Nambiar_5-1710781410016.png

     

    Expression used to calculate number of events - length(outputs('Get_calendar_view_of_events_(V3)')?['body/value'])

     

    if the condition is true> flow will create event named lab full from start of hour to end 

    Nived_Nambiar_7-1710781544030.png

     

    Nived_Nambiar_6-1710781508725.png

     

     

    for the timezone > set as per yours accordingly 🙂

     

    Hope it helps 🙂

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

     

  • swhanneman Profile Picture
    8 on at

    Thank you!  I currently see this error message:
    The input parameter(s) of action 'Get_calendar_view_of_events_(V3)' contain an invalid reference to 'Compose-StartTime'. Correct to include a valid reference to 'Compose-StartTime' for the input parameter(s) of action 'Get_calendar_view_of_events_(V3)'.

    swhanneman_0-1710864752589.png

     

  • Verified answer
    Nived_Nambiar Profile Picture
    18,136 Super User 2025 Season 2 on at

    Hi @swhanneman 

     

    This happens because the action name for compose action at the start in my case is Compose-StartTime, while in your flow , it is Compose StartTime.

     

    So when taking the dynamic content, hover over that and see what is the name of action used in the dynamic content.

    Nived_Nambiar_0-1710954154392.png

     

    In your case end time expression should be like this - addHours(outputs('Compose_StartTime'),1)

     

     

    Note that when action name changes- expression also changes accordingly.

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

     

  • swhanneman Profile Picture
    8 on at

    Good catch; I wasn't able to spot that.  I greatly appreciate your help with this - thank you very much!

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…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 339 Super User 2025 Season 2

#1
trice602 Profile Picture

trice602 339 Super User 2025 Season 2

#3
David_MA Profile Picture

David_MA 270 Super User 2025 Season 2

Last 30 days Overall leaderboard