cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GauravG
Continued Contributor
Continued Contributor

Forcing a People Picker to not search users across Organization but just an Office group

Hi All,

This control below searches users across the organization. It's a SP integrated form and we have a People Data Type in the list.

GauravG_0-1620243287191.png

Is there a way for this combo-box to search only in 1 office group.

I have a group already which i am using for field visibility in the Power App on OnStart property of App, as shown below.

Please suggest

GauravG_1-1620243466467.png

@RandyHayes Hey Randy, tagging you since you are live!

3 ACCEPTED SOLUTIONS

Accepted Solutions
zaphod88
Responsive Resident
Responsive Resident

Set the Items property to
'Office365-Groups'.ListGroupMembers("GroupID").value.mail
or create a Collection of the group members to show it in the combobox.

View solution in original post

RandyHayes
Super User III
Super User III

@GauravG 

Still live but way behind on responses....

 

You will not be able to easily get what you are looking for with the Combobox.  It will only display images for records coming from the SharePoint person column choices (this is because that record includes a picture - ListGroupMembers will not).

You could try to induct in pictures in to the items record, but the combobox will not recognize it properly because it would need to be converted to another format that it is expecting.

 

So, you really need to either just use the Person column or forget about the pictures, or create some other conglomerate of gallery and searching to do it (not a trivial task).

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

RandyHayes
Super User III
Super User III

@GauravG 

Yes, Office365 Users are a different record schema than a SharePoint user.

You will run into issues with the Items property you have as you are restricting the column results to be only displayName.  This will exclude all of the information you will need.

So, change your Items property to:

Sort(
    Office365Groups.ListGroupMemebers(xxxxxxxxxxxxx).value,
    displayName
)

This will retain the entire record information for the 365 User.

 

Then change your Update property to:

{ 
      Claims:"i:0#.f|membership|" & Lower(DataCardValue18_3.Selected.email), 
      Department: "", 
      DisplayName: DataCardValue18_3.Selected.displayName, 
      Email: DataCardValue18_3.Selected.email, 
      JobTitle: ".", 
      Picture: "."
}
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

10 REPLIES 10
zaphod88
Responsive Resident
Responsive Resident

Set the Items property to
'Office365-Groups'.ListGroupMembers("GroupID").value.mail
or create a Collection of the group members to show it in the combobox.

View solution in original post

GauravG
Continued Contributor
Continued Contributor

@zaphod88 Thanks

The issue i see is that it just shows email now. (No image, no name)

GauravG_1-1620244573212.png

Can it not show as it does when it searches cross the organization- wherein it has images as well.

GauravG_2-1620244733897.png

 

RandyHayes
Super User III
Super User III

@GauravG 

Still live but way behind on responses....

 

You will not be able to easily get what you are looking for with the Combobox.  It will only display images for records coming from the SharePoint person column choices (this is because that record includes a picture - ListGroupMembers will not).

You could try to induct in pictures in to the items record, but the combobox will not recognize it properly because it would need to be converted to another format that it is expecting.

 

So, you really need to either just use the Person column or forget about the pictures, or create some other conglomerate of gallery and searching to do it (not a trivial task).

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

GauravG
Continued Contributor
Continued Contributor

I'll stay with Display Name field instead of Mail- that helps me.
I'll forget about the images- because we want search to be looking only at our team folks. Thanks

RandyHayes
Super User III
Super User III

@GauravG 

Very good, then set the Items property to:

Office365Groups.ListGroupMembers("yourGroupID").value

Then go to Edit field and change to the style you want.  You can have single layout or double.  Single if you just want displayname, double if you want something else.  Then set the Primary Text to displayName and the SearchField to displayName if you are allowing searching.  If setting to double layout, then set the Secondary text to whatever else you want.

RandyHayes_0-1620257537569.png

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes
GauravG
Continued Contributor
Continued Contributor

@RandyHayes The the value in this column is not getting saved, and i am able to save the form without seeing any error. The items property is as shown below

GauravG_0-1620821390301.png

And the Update Property of the control is DataCardValue18_3.Selected

In my SP list, the properties are as shown below:

GauravG_1-1620821876111.png

I thought that since the Choose From is set to be coming from ALL USERS, it may be interfering with saving the Power App field value since we are searching from an AD group in the app in SP list (as shown above).

The weird thing is that i can't change the data type from Person/ Group to Single Line of Text or any other data type.

RandyHayes
Super User III
Super User III

@GauravG 

Yes, Office365 Users are a different record schema than a SharePoint user.

You will run into issues with the Items property you have as you are restricting the column results to be only displayName.  This will exclude all of the information you will need.

So, change your Items property to:

Sort(
    Office365Groups.ListGroupMemebers(xxxxxxxxxxxxx).value,
    displayName
)

This will retain the entire record information for the 365 User.

 

Then change your Update property to:

{ 
      Claims:"i:0#.f|membership|" & Lower(DataCardValue18_3.Selected.email), 
      Department: "", 
      DisplayName: DataCardValue18_3.Selected.displayName, 
      Email: DataCardValue18_3.Selected.email, 
      JobTitle: ".", 
      Picture: "."
}
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

GauravG
Continued Contributor
Continued Contributor

Vow! No words- it worked.

The only change i had to make was to replace email with mail in the Update property.

Can you share a brief or link on info on what you did with the Update property? Haven't ever seen this Claims thing before.

RandyHayes
Super User III
Super User III

@GauravG 

Glad it helped out!!

Yes I can never remember which ones are email, Email, and mail.  Surprisingly enough, I understand why they made them all different.

 

I am not sure about any particular information on the user record - although I am sure there are plenty of articles about the SharePoint user record.  That is what it is.  The SharePoint user management system uses a Claims column to identify users.  Not to mention other column types.

So, in the formula, we just converted the Office365 user record from the selection in the combobox to a record that is compatible with a SharePoint user.  

One of those things that you just have to know about user records, and one of those things that you put into a OneNote somewhere so you can reference it.  After over 3+ years doing it, I still look it up in my OneNote every time.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,188)