cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JacobLindgren
Level: Power Up

Delete all calendar event from a day

Hi,
I'm trying to build a "Report being sick-flow" where users can press the mobile button that triggers a post about being sick in a Teams channel and remove all calendar events from the users calendar. 
Struggling with getting events for the days that the button is pressed, anyone have a clue?

1 REPLY 1
Highlighted
Community Support Team
Community Support Team

Re: Delete all calendar event from a day

Hi @JacobLindgren,

 

Do you want to delete all the activities that started on the day the button was clicked?

You could use Get events to get the start time of all the events, then use utcNow() function to get the date the button clicked on the day. Then delete all the events that the user started that day.

Use formatDateTime() to convert the two times obtained above, leaving only the date part to determine whether it is equal. If it is equal, delete the corresponding event.

I have made a test on my side and the flow works well.

Image reference:

45.PNG

Condition-- Formula reference:

formatDateTime(items('Apply_to_each')['Start'],'dd-MM-yyyy')

is equal to

formatDateTime(utcNow(),'dd-MM-yyyy')

46.PNG

In addition, if you want to delete all the activities of the day, not the activities that started the day, you could change the formula to the following in the Condition-advanced mode:

@or(equals(formatDateTime(items('Apply_to_each')['Start'], 'dd-MM-yyyy'), formatDateTime(utcNow(), 'dd-MM-yyyy')),equals(formatDateTime(items('Apply_to_each')['End'], 'dd-MM-yyyy'), formatDateTime(utcNow(), 'dd-MM-yyyy')))

Like:

47.PNG

Take a try and feel let me know if you have any question.

 

Best Regards,

Barry

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

Helpful resources

Announcements
firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (4,422)