Skip to main content
Community site session details

Community site session details

Session Id : egx2/poaxnVgy7Dd+lJhFu
Power Automate - Building Flows
Answered

Create Calendar event over multiple days between set times?

Like (0) ShareShare
ReportReport
Posted on 6 Sep 2022 11:28:48 by 45

Hello,
Any help with this issue would be greatly appreciated.
So essentially I have a Microsoft form that our project managers use to schedule events that can span over several days.
For examples in the photo i'd want the event to start 13/09/2022 at 23:00 and finish on 15/09/2022 at 06:00 but id want an event for each day so 13/09/2022 11pm - 14/09/2022 6am and 14/09/2022 11pm - 15/09/2022
However when I create the calendar events it will schedule the event for the whole day between them dates, is there anyway to get power automate to create an event for each day between the specific time period?

 

The dates and times are captured in an MS form as you can see on the last photo.

 

Any help greatly appreciated 🙂 

 

Screenshot 2022-09-06 at 12.03.55.pngScreenshot 2022-09-06 at 12.04.04.pngScreenshot 2022-09-06 at 12.25.21.pngScreenshot 2022-09-06 at 12.27.41.png

 
  • 19Flash92 Profile Picture
    45 on 15 Sep 2022 at 09:42:10
    Re: Create Calendar event over multiple days between set times?

    EDIT:

     

    Hello Damien - realised my error, I never updated the 'composefirstenddate'.

     

    Fully working now - please let me know a way I can buy you a coffee/beer. 

  • 19Flash92 Profile Picture
    45 on 09 Sep 2022 at 18:48:06
    Re: Create Calendar event over multiple days between set times?

    I’ll try this for sure, thanks for all the help so far.

  • Verified answer
    DamoBird365 Profile Picture
    8,942 Microsoft Employee on 06 Sep 2022 at 20:12:09
    Re: Create Calendar event over multiple days between set times?

    Hi @19Flash92 

     

    I see what you mean.  So this will require some additional logic. 

     

    Based on 7th 12:00 to 10th 17:00

     

    if(less(body('Subtract_from_time'),parsedatetime(outputs('ComposeStart'))),1,0)

     

    If the subtract from time (7th 17:00) is less than the start time (7th 12:00), we add 1 day to the first end date, else 0.  Therefore the end date 7th 17:00 + 0 in this case.  I have added a compose to make this calculation and updated the composefirstenddate to adddays(body('Subtract_from_time'),outputs('ComposeTimeCheck')).

     

    if(less(body('Subtract_from_time'), parsedatetime(outputs('ComposeStart'))),0,1)

     

    If the subtract from time (7th 17:00) is less than the start time (7th 12:00), we add 0 days to the range or date difference, otherwise in this case, we add on 1.  I have added a compose for this calculation of logic too and I have updated the range to 

    range(0,add(outputs('ComposeDifferenceDays'),outputs('ComposeTimeCheckRange')))
     
    DamoBird365_0-1662494946284.png

    Based on testing....

    DamoBird365_1-1662494962037.png

     

    returns:

    DamoBird365_2-1662494987071.png

    and...

    DamoBird365_3-1662495022449.png

     

    returns:

    DamoBird365_4-1662495036993.png

    I tested on matching times too and you would get three events based on both times being the same.

     

    Please let me know if that works for you.  I was trying to think of more simple logic, but not sure how.

     

    Damien

  • 19Flash92 Profile Picture
    45 on 06 Sep 2022 at 16:34:23
    Re: Create Calendar event over multiple days between set times?

    Hello Damien,

     

    Thanks for the reply.

     

    I'd expect:

    7th - 7th

    8th - 8th 

    9th - 9th

    10th - 10th 

     

    As the times don't overlap a day, so each event will take place on the same between 12:00 - 17:00. 

     

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on 06 Sep 2022 at 16:06:18
    Re: Create Calendar event over multiple days between set times?

    Hi @19Flash92 

     

    To create the events, you would add an apply to each, insert the select as input and the add expressions item()?['start'] and item()?['end'].

     

    DamoBird365_0-1662480195150.png

     

    Regarding your question about the 7th 12:00 to 10th 17:00, it's giving you

    7th - 8th

    8th - 9th

    9th - 10th

    What would you be expecting?

     

    Damien

  • 19Flash92 Profile Picture
    45 on 06 Sep 2022 at 15:06:53
    Re: Create Calendar event over multiple days between set times?

    Also I tested this again but this time using 2 times over 5 days that don't go into separate days and it's basically created the out put below:

     

    Screenshot 2022-09-06 at 15.56.30.png

     

    Inputs I used were:

     

    Screenshot 2022-09-06 at 15.54.55.png

     

    Maybe I need to change something on my form to capture more data? 

  • 19Flash92 Profile Picture
    45 on 06 Sep 2022 at 14:45:53
    Re: Create Calendar event over multiple days between set times?

    Perfect working now, I've watched your array video and subscribed but I'm still lost on how I convert them Arrays into multiple calendar events. 

     

    If your able to help me with the last part I'll tip you with a coffee/beer 😄

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on 06 Sep 2022 at 14:11:32
    Re: Create Calendar event over multiple days between set times?

    Hi @19Flash92 

     

    It's my bad, the expression for first end date should be adddays(body('Subtract_from_time'),1) - I don't know how I managed to copy that into the screenshot wrong.  Hopefully that sorts you.

     
    Damien
  • 19Flash92 Profile Picture
    45 on 06 Sep 2022 at 13:03:41
    Re: Create Calendar event over multiple days between set times?

    Most likely I have done something wrong on a previous step as here are the outputs:

     

    Screenshot 2022-09-06 at 14.02.30.pngScreenshot 2022-09-06 at 14.02.53.pngScreenshot 2022-09-06 at 14.02.57.png

  • 19Flash92 Profile Picture
    45 on 06 Sep 2022 at 12:43:32
    Re: Create Calendar event over multiple days between set times?

    Hello Damien,

     

    Really appreciate the detailed reply.

     

    I've tried to follow the steps and I'm now running into this error:

     

    Screenshot 2022-09-06 at 13.42.02.pngScreenshot 2022-09-06 at 13.42.17.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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1