web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Combobox does not show...
Power Apps
Unanswered

Combobox does not show Persons Photos when using : Office365Users.SearchUser

(0) ShareShare
ReportReport
Posted on by 21

I have a combobox that was used based on 

 

 

Items = Choices([@List].User)

 

 

Since User is a column in a Sharepoint @List of type Person, the combobox is looking for the users of all the company, and not only limited to the persons already added to the Sharepoint List.  

But in some context, I need to remove from the suggested users Persons from "Spain". How to do that keeping the same behaviour: getting users from all the company, not only from the Sharepoint List ?

If I will do this, that will look only inside the file, and no more for all the user of the company:

 

 

Filter(
 AddColumns(
 Choices([@List].User),
 Country,
 LookUp(
 Office365Users.SearchUser({searchTerm: DisplayName}),
 Email = ThisRecord.Mail,
 Country
 )
 ),
 Country<>"Spain"
)

 

 

 

So I decided to move to use instead of the last method (Choices) the following way:

 

 

Filter(
 Office365Users.SearchUser({searchTerm:Combobox_1.SearchText, top:10}),
 Country <> "Spain"
),

 

 

 

But here there is no photos and I am asked to show the photos of the users. So I tried to do this:

 

 

AddColumns(
 Filter(
 Office365Users.SearchUser({searchTerm:Combobox_1.SearchText, top:10}),
 Country <> "Spain"
 ),
 Photo,
 Office365Users.UserPhotoV2(Id)
)

 

 

Of course I set the display field of the combobox to "Person" and set the image filed to the added column "Photo".

 

To make it easy you can try only with the following code, and you can not have the photos of the users shown with the combobox:

 

AddColumns(
 Office365Users.SearchUser({searchTerm:Combobox_1.SearchText, top:10}),
 Photo,
 Office365Users.UserPhotoV2(Id)
)

 


But have not been able to show the image of the persons on the combobox suggestions. If I use code with another component like a Vertical Gallery, I will see the photos of the users. But this is not working with to Combobox component.

 

It is an urgent FIX, so any help would be greatly appreciated!  
Many thanks!

Categories:
I have the same question (0)
  • Suggested answer
    DHod Profile Picture
    2 on at
    I ran into the same problem and discovered your old post while I was trying to find a solution. I figured out a fix and thought I'd share it here in case anyone else looking for an answer finds this thread, or if this ends up being helpful to you OP, even if it's been almost a year!
     
    Here is my solution: when creating the collection that the combobox will display, the column that contains the user's image must contain a base64-encoded string in order for the combobox to display it correctly. The issue is that many sources, including Office365Users.UserPhotoV2 return images in a different format that the combobox cannot display.
     
    Fortunately, there is a simple way to re-encode images into base64 within Power Apps, using the JSON() formula. Here is example code that I have working in my app:
     
    In this example, ColComboBoxPeoplePicker is a collection that already contains the standard Office365Users profile information that is output from Office365Users.SearchUser. This code adds a userPhoto column and populates it using Office365Users.UserPhotoV2, but uses the JSON() formula to convert the user photo to base64, and the substitute formula to remove quotation marks from the output base64 string
     
    AddColumns(
    	ColComboBoxPeoplePicker, //collection of office365 users to display in the combobox
    	userPhoto, //add a column called userPhoto to ColComboBoxPeoplePicker
    	Substitute( //remove quotation marks from the Base64-encoded image string
    		JSON( //use JSON() with JSONformat.IncludeBinaryData to convert the image to a Base64-encoded string
    			If(
    				Office365Users.UserPhotoMetadata(id).HasPhoto, //check if the user has uploaded a photo using their id from ColComboBoxPeoplePicker 
    				Office365Users.UserPhotoV2(id), //if they have uploaded an image, get it using their id from ColComboBoxPeoplePicker
    				BlankContactImage //if they have not uploaded an image, use a blank profile image uploaded to the Power App's media folder
    			),
    			JSONFormat.IncludeBinaryData
    		),
    		"""", //find quotation marks in the base64-encoded image string
    		"" //replace them with blanks
    	)
    )
     
    the userPhoto column can now be set as the source of the image in the people picker combobox and it will correctly display the images.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard