One of the things I love most about the Power Platform is how quickly you can build a solution to a problem using a little bit of low code magic.
I have been working on a Power App with a colleague and we were casually chatting in teams about it. We agreed that we should have a meeting to run through some of the last few items on the backlog before we get it into testing and production.
Both of our calendars are pretty busy and so I had a bit of a lightbulb moment. Why can't you quickly send a list of options to your colleague for them to pick a time that works for them when you're both free...
Sure, I could use the create a meeting, but even the scheduling assistant assumes the time you choose is their preferred time.
So, off to work I went and built a nice little add in that allows you to do just that!
Getting the Workflow Ready
First, I click on the chat ellipsis, go to 'More actions' and then 'Create new action'.
![](https://static.wixstatic.com/media/699013_e1f8c8f11c834f1fb6e7369f2e8af81e~mv2.png/v1/fill/w_700,h_572,al_c,q_90,enc_auto/699013_e1f8c8f11c834f1fb6e7369f2e8af81e~mv2.png)
My trigger for this workflow is to run 'For a selected message'.
![](https://static.wixstatic.com/media/699013_6716e8d1d864498a8505a93bdd7eb2e1~mv2.png/v1/fill/w_617,h_59,al_c,q_85,enc_auto/699013_6716e8d1d864498a8505a93bdd7eb2e1~mv2.png)
Then I am going to get the message details, using the dynamic fields Message ID and Conversation ID for the Group chat.
![](https://static.wixstatic.com/media/699013_4f8c0a14d2e34b589350b844f1b4c001~mv2.png/v1/fill/w_619,h_195,al_c,q_85,enc_auto/699013_4f8c0a14d2e34b589350b844f1b4c001~mv2.png)
Next, I want to get some of the user details to use in the workflow, so I am using the Office 365 connectors 'Get my profile (V2)' and 'Search for users (V2)'.
![](https://static.wixstatic.com/media/699013_bea6268419db4c60a1e2ae2e2dd682f4~mv2.png/v1/fill/w_627,h_312,al_c,q_85,enc_auto/699013_bea6268419db4c60a1e2ae2e2dd682f4~mv2.png)
Now I have the message details and the users involved in the chat I need to move on to the next stage of my workflow!
Finding our availability
To find the availability of the users in the chat, I need to use the Find meeting times (V2) action. As I input the emails for myself and the user, I am chatting to it will create an apply to each loop. There are ways to get around this but for now this will do.
First I need to create a variable to store the available times so I do a quick Initialize variable action:
![](https://static.wixstatic.com/media/699013_b195cfe76e104e659f7e41b74b242e24~mv2.png/v1/fill/w_621,h_193,al_c,q_85,enc_auto/699013_b195cfe76e104e659f7e41b74b242e24~mv2.png)
I want the tool/workflow to find times from 'now' and up to 10 days in advance. I know that my outlook will only schedule during working hours so I don't need to worry about weekends here.
I have two expressions:
utcNow()
addDays(utcNow(),10)
![](https://static.wixstatic.com/media/699013_3730f11655164f899d9851a0d4012fee~mv2.png/v1/fill/w_681,h_804,al_c,q_90,enc_auto/699013_3730f11655164f899d9851a0d4012fee~mv2.png)
Building the adaptive card
Now I need to build an adaptive card so that the person I am chatting to can select a list of available dates.
First I use the compose function to get my variable into a usable function. The I use the Select function to build my choice list.
![](https://static.wixstatic.com/media/699013_12d0aa841dda4effbaee95ec37ae35fb~mv2.png/v1/fill/w_617,h_393,al_c,q_85,enc_auto/699013_12d0aa841dda4effbaee95ec37ae35fb~mv2.png)
I wanted my dates and times to be user friendly so I added in two functions here
formatDateTime(item()?['start']?['dateTime'],'dddd dd MMMM hh:mm tt')
Separate them with a dash
formatDateTime(item()?['end']?['dateTime'],'hh:mm tt')
For the value I am choosing the start.ddateTime dynamic value as I want to use this when booking in the meeting.
Next I need to create an Array to put the choices that have been formatted into the JSON for the adaptive card. This is the body of the Select function
body('Select')
![](https://static.wixstatic.com/media/699013_4e1a967a7f32400c90f92aff7d2cc52e~mv2.png/v1/fill/w_621,h_194,al_c,q_85,enc_auto/699013_4e1a967a7f32400c90f92aff7d2cc52e~mv2.png)
Next I am going to choose the Post an adaptive card and wait for a response action
![](https://static.wixstatic.com/media/699013_52df4596316d4106ae65644a03882b89~mv2.png/v1/fill/w_620,h_133,al_c,q_85,enc_auto/699013_52df4596316d4106ae65644a03882b89~mv2.png)
![](https://static.wixstatic.com/media/699013_64f79a6988364387a13c1d0dfa9abdde~mv2.png/v1/fill/w_636,h_101,al_c,q_85,enc_auto/699013_64f79a6988364387a13c1d0dfa9abdde~mv2.png)
The body for the adaptive card is below but make sure to put in your variable for the choices.
![](https://static.wixstatic.com/media/699013_66776e48d96d48d685ccece4f6088b3b~mv2.png/v1/fill/w_281,h_173,al_c,q_85,enc_auto/699013_66776e48d96d48d685ccece4f6088b3b~mv2.png)
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"text": "Meeting Poll Request",
"id": "Title",
"spacing": "Medium",
"horizontalAlignment": "Center",
"size": "ExtraLarge",
"weight": "Bolder",
"color": "Accent"
},
{
"type": "TextBlock",
"text": "Let's find a time to meet!",
"id": "acHeaderTagLine",
"separator": true
},
{
"type": "TextBlock",
"text": "Hi, I've checked our calendars and here are some times we can meet",
"id": "acInstructions",
"wrap": true
},
{
"type": "TextBlock",
"text": "Meeting Poll",
"id": "acPollQuestion"
},
{
"type": "Input.ChoiceSet",
"placeholder": "Select from these choices",
"choices": @{variables('VarMeetingChoices')},
"id": "acPollChoices",
"style": "expanded"
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Submit",
"id": "btnSubmit"
}
]
}
Next I am using the Parse JSON action to get the bits I need from the response of the adaptive card.
The Content in the below is the body of the adaptive card action.
![](https://static.wixstatic.com/media/699013_50ebae8540994712ae68e19483f4d769~mv2.png/v1/fill/w_622,h_345,al_c,q_85,enc_auto/699013_50ebae8540994712ae68e19483f4d769~mv2.png)
I have pasted the Schema below for speed if building this yourself.
{
"type": "object",
"properties": {
"responseTime": {
"type": "string"
},
"responder": {
"type": "object",
"properties": {
"objectId": {
"type": "string"
},
"tenantId": {
"type": "string"
},
"email": {
"type": "string"
},
"userPrincipalName": {
"type": "string"
},
"displayName": {
"type": "string"
}
}
},
"submitActionId": {
"type": "string"
},
"messageId": {
"type": "string"
},
"messageLink": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"acPollChoices": {
"type": "string"
}
}
}
}
}
Getting the meeting booked in
The last step is to automatically book the meeting in when the user has selected an option. I have added in a few bits to make the invite useful, such as adding in a link to the chat in Teams that caused us to need this meeting.
The start time you can get from the 'acPollChoices' dynamic content
![](https://static.wixstatic.com/media/699013_26981a3b1de34974a6565ef7e2395c77~mv2.png/v1/fill/w_624,h_502,al_c,q_85,enc_auto/699013_26981a3b1de34974a6565ef7e2395c77~mv2.png)
Testing it out
So, now when I am chatting to a user I can click on my new action
![](https://static.wixstatic.com/media/699013_e9e70dbcde284cddbb5365c597180e1a~mv2.png/v1/fill/w_487,h_347,al_c,q_85,enc_auto/699013_e9e70dbcde284cddbb5365c597180e1a~mv2.png)
It sends an adaptive card to the user
![](https://static.wixstatic.com/media/699013_e6c2662876c3472c803d2b1e9fde4cdd~mv2.png/v1/fill/w_504,h_784,al_c,q_90,enc_auto/699013_e6c2662876c3472c803d2b1e9fde4cdd~mv2.png)
And finally, the meeting booked in our calendars
![](https://static.wixstatic.com/media/699013_2cecf29bcda04cdfb6d41ec13f547b4c~mv2.png/v1/fill/w_980,h_580,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/699013_2cecf29bcda04cdfb6d41ec13f547b4c~mv2.png)
Comments