I have a canvas app and I'd like to display a user's photo based on value in a collection, ideally using Switch().
For example: If the collection contains "EmployeeID1234," show the photo for Silvia. If the collection contains "EmployeeID5678," show the photo for Ernest, etc.
I can use this to display a user's photo based on their email address:
// Image Property
Office365Users.UserPhotoV2("silvia@example.com")
But I'd like to change the photo in the Image control based on the "EmployeeID" field in my collection. Something like this (which isn't working):
With({
wPhoto: LookUp(colMyCollection, ThisRecord.EmployeeID = Switch(EmployeeID,
"EmployeeID1234", Office365Users.UserPhotoV2("silvia@example.com"), // Show Silvia's photo
"EmployeeID5678", Office365Users.UserPhotoV2("ernest@example.com"), // Show Ernest's photo
"EmployeeID9112", Office365Users.UserPhotoV2("oscar@example.com") // Show Oscar's photo
))
},
If(!IsBlank(wPhoto), wPhoto, 'no-profile-photo')
)
If the user doesn't have a profile photo, I'd like to show my default image called "no-profile-photo."