This blog will discuss how to use SharePoint Security Group to limit or filter the persons in the PowerApps Person Combo box instead of listing all users.
Background
We can use the SharePoint Persons column or Office365Users to list the users on Persons Combo. But if you want to restrict the persons to display using SharePoint security group is not straightforward.
To use SharePoint Person Column, Set the Items property of the Combo box to
Choices(SPList.PersonColumnName)
To use Office365Users then
Office365Users.SearchUser({searchTerm: “”})
Setup
Below are steps to setup Sharepoint security group using Office 365 admin center
- Go to Office 365 Admin Center
- Create SharePoint Security Group
- Add Members to the Group
- Get the Group ID (GUID) from the Address Bar
Steps to use SharePoint Group
- Set the Items property of Combo box to
2. Set the DefaultSelecteditems property to the Person combo box to
3. Set the Update Property of Person Datacard to
Output
Person Combo box shows the persons or members from Sharepoint Security Group instead of the full list
Sample Screenshots for Reference
Power Fx Commands
Office365Groups.ListGroupMembers(“SharePoint Security Group GUID”).value
If(
!IsBlank(ThisItem.’Assigned to’.Email),
Office365Users.UserProfileV2(ThisItem.’Assigned to’.Email),
Blank()
)
If(
!IsBlank(DataCardValue13.Selected.mail),
{
Claims: “i:0#.f|membership|” & Lower(DataCardValue13.Selected.mail),
Department: “”,
DisplayName: Lower(DataCardValue13.Selected.displayName),
Email: Lower(DataCardValue13.Selected.mail),
JobTitle: “”,
Picture: “”
},
Blank()
)
Group By on Person field not working as it worked for choice columns.
It’s working on Choice field
AddColumns(GroupBy(AddColumns(colForChart,”name1″,Status.Value),”name1″,”TestName”),”Number”,CountRows(TestName)) – Returns Count against each status
It’s not working on Person field
//AddColumns(GroupBy(AddColumns(colForChart,”name2″,’Assigned To’.DisplayName),”name2″,”TestName2″),”Number”,CountRows(TestName2))
Appreciate any help on this.
Thank you
It should work. Please find the below code which I tested.
ClearCollect(
ColCountRowsPerson,
AddColumns(
GroupBy(
AddColumns(
IssueTracker,
“PersonName”,
‘Assigned to’.DisplayName
),
“PersonName”,
“RecordDetails”
),
“StatusCount”,
CountRows(RecordDetails)
)
)