Requirement
We had a requirement recently to filter the list of users in PowerApps from the Azure AD group. The client has a specific group called “Executive Sponsors” that only list should show in the list of users/person to select in PowerApps. And PowerApps uses Sharepoint as a data source.
Challenge
Person record in Sharepoint is different from Azure AD User. Both Schema and structure are different. We can’t directly use it.
Solution
To display the ComboBox, we need Azure AD Connector, and the Azure AD user needs to be converted to a SharePoint Person record when we save the data.
Azure AD Group SetUp
- Go to Azure AD
- Create a Group
- Select Microsoft 365 as Group Type
- Enter Name and Other basic Information
- Add members to the group
PowerApps Setup
- Have a gallery
- Have an Edit form
- Person Combo box added
- DataSource to SharePoint List
- Item property to Gallery Selected
Setup to use Azure AD group
We need to have two connectors to access the Azure AD group and User Details
- Office365Groups
- Office365Users
Set the Items property of the person combo box to
Office365Groups.ListGroupMembers(“AZURE AD GROUP GUID”).value
Set the DefaultSelectedItems of the person combo box to
If(
!IsBlank(ThisItem.’Exec Sponsor’.Email),
Office365Users.UserProfileV2(ThisItem.’Exec Sponsor’.Email),
Blank()
)
Set the Update property of the person’s Data Card to
If(
!IsBlank(ExecSponsorDataCardValue.Selected.mail),
{
Claims: “i:0#.f|membership|” & Lower(ExecSponsorDataCardValue.Selected.mail),
Department: “”,
DisplayName: Lower(ExecSponsorDataCardValue.Selected.displayName),
Email: Lower(ExecSponsorDataCardValue.Selected.mail),
JobTitle: “”,
Picture: “”
},
Blank()
)
Important: At the time of writing this blog post, to set a Blank value for the person field, we need to enable some settings
- Go to Settings
- Select “Upcoming features”
- Click the “Experimental” tab
- Enable “Formula-level error management”
Result/Output
Person Combo box shows only the users from Azure AD and is able to save successfully to SharePoint by converting Azure AD User/Object to SharePoint Person Record.
Hi Stalin.
Thanks for the article. Would it be possible to create a list, create a sharepoint permission group, associate the azure ad group in question to the newly created group, and then limit the person selection to the group from within the item settings within the sharepoint list, thereby filtering the selection list back to the app?
I’ve tried, it should work in theory, but it seems to just show nothing within the app.
Thanks,
Don