Power Automate: People Picker in Teams Adaptive Cards Using Microsoft Graph API
Scenario
In real-time automations, collecting user information such as names or email addresses is a common requirement. Relying on plain text inputs in Adaptive Cards forces users to manually enter these values, often resulting in typos or invalid data, which can negatively impact downstream automation logic.
Adaptive Cards do not natively support people picker functionality, which becomes a key limitation when posting cards to Microsoft Teams via Power Automate and requiring accurate user input.
Solution
To overcome this limitation, we can leverage Microsoft Graph API within Power Automate to retrieve user data dynamically and present it as a dropdown (ChoiceSet) in an Adaptive Card. This approach ensures controlled user selection and significantly reduces manual input errors.
Step-by-Step Implementation
Step 1: Create an Instant Cloud Flow
Create an Instant cloud flow with a manual trigger (or any suitable trigger based on your automation needs).
Step 2: Retrieve Users from Microsoft Graph
Add Send an HTTP request action from the Office 365 Users connector and configure it as shown below
Method:
GETURI: https://graph.microsoft.com/v1.0/users?$select=id,displayName,mail&$top=20
Content-Type: application/json
Step 3: Transform the Graph Response
Add a Select action from the Data Operations connector to transform the Graph response into a format supported by Adaptive Cards.
From
body('Send_an_HTTP_request:_Get_Users')['value']
Map
{
"title": item()?['displayName'],
"value": item()?['mail']
}
This creates a list of user options for the dropdown.
Step 4: Build the Adaptive Card with Dropdown
Add a Compose action and insert your Adaptive Card JSON.
Use an Input.ChoiceSet control and bind the choices property to the output of the Select action.
This dynamically populates the dropdown with users retrieved from Microsoft Graph.
JSON:
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.5",
"body": [
{
"type": "TextBlock",
"text": "Select a user",
"weight": "Bolder"
},
{
"type": "Input.ChoiceSet",
"id": "selectedUser",
"style": "compact",
"placeholder": "Choose a user",
"choices": @{body('Select:_User_properties')}
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Submit"
}
]
}
Step 5: Post Adaptive Card to Microsoft Teams
Add Post adaptive card and wait for a response action from the Microsoft Teams connector.
Post as: Flow bot
Post in: Channel
Message: @outputs('Compose:_Adaptive_Card')
Team: Select the desired team
Channel: Select the desired channel
Step 6: Capture the Selected User
Add a final Compose action to read the user selection from the card response.
Expression
Output
Best Practices
Limit the number of users in the dropdown to improve usability
Prefer user IDs over email addresses when possible
Apply filters (department, role, group) when retrieving users
Use this approach for Teams-based workflows where accuracy matters
Conclusion
Although Adaptive Cards in Microsoft Teams do not provide native people picker support, combining Power Automate with Microsoft Graph API offers a reliable and supported workaround. By dynamically populating a dropdown with user data, you can improve data accuracy, enhance user experience, and build more resilient automations.
This pattern is especially useful for approvals, task assignments, and request routing scenarios in Microsoft Teams.
Comments
Post a Comment