cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MartinC
Regular Visitor

Checking calendar for existing events between 2 dates entered

Hi

First post folks  for someone just trying to learn,so be gentle 🙂

Can anyone suggest the best way to check a calendar for any existing appointments between the start date and end date of the new event bing entered.

 

Not really sure of how to even get started with this so any advice or tips to push me in the right direction would be great.

 

Thanks in advance

Martin

1 ACCEPTED SOLUTION

Accepted Solutions
v-yamao-msft
Community Support
Community Support

Hi @MartinC,

 

Do you want to get existing events that start time between the start date and end date of a new event?

 

If yes, please try the following flow for a reference.

 

I add a Condition in the flow and the code is:

@and(greaterorequals(formatDateTime(items('Apply_to_each')?['Start'],'yyyy-MM-dd'), formatDatetime(triggerBody()?['Start'],'yyyy-MM-dd')),lessorequals(formatDateTime(items('Apply_to_each')?['Start'],'yyyy-MM-dd'),formatDatetime(triggerBody()?['End'],'yyyy-MM-dd')))

Note: Make sure the dates are in the same format.

 

When a new event is created, get the existing events, then use the condition to filter out the items that between the start date and end date of the new event.

 

It works fine, please try it on your side.

1.PNG

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yamao-msft
Community Support
Community Support

Hi @MartinC,

 

Do you want to get existing events that start time between the start date and end date of a new event?

 

If yes, please try the following flow for a reference.

 

I add a Condition in the flow and the code is:

@and(greaterorequals(formatDateTime(items('Apply_to_each')?['Start'],'yyyy-MM-dd'), formatDatetime(triggerBody()?['Start'],'yyyy-MM-dd')),lessorequals(formatDateTime(items('Apply_to_each')?['Start'],'yyyy-MM-dd'),formatDatetime(triggerBody()?['End'],'yyyy-MM-dd')))

Note: Make sure the dates are in the same format.

 

When a new event is created, get the existing events, then use the condition to filter out the items that between the start date and end date of the new event.

 

It works fine, please try it on your side.

1.PNG

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

This works for me however Im struggling to show the results , is there an easy way to embed a calendar view or a list of the existing events in an email ?

 

Thanks

M

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (4,474)