
Announcements
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!
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
)
)