How To Create Calendar Events From A Power App

You've built an amazing Vacation booking solution in Power Apps that allows for easy approvals using components like a date picker. But how do you take it to the next level and automatically generate Outlook calendar events when time off is approved? In this post, I'll walk through a simple way to make this happen with Power Automate.

The Problem with Date Pickers

Power Apps date pickers are great for selecting dates for events, time off, appointments etc. But one limitation is that they only allow choosing a date, not a specific time. The date picker defaults any selection to midnight (00:00) for the time.

This doesn't work when you need to create real calendar events, like in Outlook, which require both a start and end date and time. Under the hood, Outlook events also expects to be talked to in values which align to the ISO 8601 formatted standard so you it's not just a case of passing it a value from your data picker and letting it do the rest!

The Solution with Power Automate

With a few simple steps, using Power Apps and Power Automate in tandem, we can:

  1. Allow the user to pick a time value to go with their date selection
  2. Build the properly formatted ISO datetime string required for Outlook within Power Automate
  3. Create the calendar event dynamically in Power Automate

Here's how:

  1. Add controls in Power Apps to allow for a time value to be input by the user as well as a using a date picker. If you ONLY ever want the leave bookings to run for full days, you can hard code the time values into Power Automate but I'd recommend adding flexibility. 
  2. A quick tip for creating the time drop downs - use the Sequence() formula to create a list of numbers for the drop down e.g Sequence(12) will give you 12 hours to pick from in a list within the Drop Down control.  
  3. Pass the data from the controls into a Power Automate flow as Input variables.
  4. Construct the full timestamp within Power Automate by using a Compose. Within this, you can concatenate the date from your date picker with the chosen time values.
  5. To comply with the ISO format standard, include "T" after the date to indicate the beginning of the time values.
  6. Be sure to add ":00" to the string at the end to format it properly with years, months, days, hours, minutes and seconds data included.
  7. Use Replace() to change what PowerApps gave you in the date  ("/") with  "-" to complete the ISO format needed.
  8. Finally, use the "Create event" Outlook connector action to create the calendar event, passing it the formatted date/time strings as the start and end values.

With these simple steps, your Power Apps date selection can now automatically create a corresponding Outlook calendar event when a date is chosen! The user experience is smooth and seamless.

Unsure how to complete all these steps?

Watch the video at the top of this post for a step-by-step instruction. 

Next Steps

There are many ways you could build on this solution:

  • Enhance it by allowing the user to choose event names, details etc
  • Build in validation and error handling to catch any issues with dates and times
  • Experiment with launching Calendar events directly within Power Apps (yes this IS possible!)

If you want to learn how to build a fully functioning and scalable Holiday booking solution with the Power Platform, sign up to take our on demand Vacation Booking course via our Platinum Plan.

Join 11,000+ in the Collab365 Academy

Master Microsoft 365, Power Apps, Power Automate, Power BI, SharePoint with Exclusive Access to 450+ Hours of Expert Training and a Wealth of Resources!