How to Auto-Create Outlook Calendar Events from Power Apps
At a Glance
- Target Audience
- Power Apps Developers
- Problem Solved
- Power Apps date pickers default to midnight (00:00) without time or ISO 8601 format needed for Outlook calendar events.
- Use Case
- Vacation booking or time-off approval apps auto-creating Outlook calendar events on approval.
<p>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.</p>
<h2 id="the-problem-with-date-pickers">The Problem with Date Pickers</h2><p>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.</p>
<p>This doesn’t work when you need to create real calendar events, like in Outlook, which require both a start and end date <strong>and</strong> 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!</p>
<h2 id="the-solution-with-power-automate">The Solution with Power Automate</h2><p>With a few simple steps, using Power Apps and Power Automate in tandem, we can:</p>
<ol>
<li>Allow the user to pick a time value to go with their date selection</li>
<li>Build the properly formatted ISO datetime string required for Outlook within Power Automate</li>
<li>Create the calendar event dynamically in Power Automate</li>
</ol>
<h3 id="heres-how">Here’s how:</h3><ol>
<li>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. </li>
<li>A quick tip for creating the time drop downs – use the <strong>Sequence()</strong> 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. </li>
<li>Pass the data from the controls into a Power Automate flow as Input variables.</li>
<li>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.</li>
<li>To comply with the ISO format standard, include “T” after the date to indicate the beginning of the time values.</li>
<li>Be sure to add “:00” to the string at the end to format it properly with years, months, days, hours, minutes and <strong>seconds</strong> data included.</li>
<li>Use <strong>Replace()</strong> to change what PowerApps gave you in the date (“/”) with “-” to complete the ISO format needed.</li>
<li>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.</li>
</ol>
<p>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.</p>
<h3 id="unsure-how-to-complete-all-these-steps">Unsure how to complete all these steps?</h3><p>Watch the video at the top of this post for a step-by-step instruction. </p>
<h2 id="next-steps">Next Steps</h2><p>There are many ways you could build on this solution:</p>
<ul>
<li>Enhance it by allowing the user to choose event names, details etc</li>
<li>Build in validation and error handling to catch any issues with dates and times</li>
<li>Experiment with launching Calendar events directly within Power Apps (yes this IS possible!)</li>
</ul>
<p>Join Collab365 Spaces for Power Apps news, research and learning resources.</p>
