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 🙂
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.
I’ll try this for sure, thanks for all the help so far.
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
Based on testing....
returns:
and...
returns:
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
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.
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'].
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
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:
Inputs I used were:
Maybe I need to change something on my form to capture more data?
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 😄
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.
Most likely I have done something wrong on a previous step as here are the outputs:
Hello Damien,
Really appreciate the detailed reply.
I've tried to follow the steps and I'm now running into this error:
Michael E. Gernaey
497
Super User 2025 Season 1
David_MA
436
Super User 2025 Season 1
Riyaz_riz11
244
Super User 2025 Season 1