1

I am new power apps, by the way it is awesome. I just created a lovely tabbed form that also has conditional fields. And I am trying to add a customer people picker. The images don't come in so I found this code that recommended to look for an image or use another image instead. When I use the code I get an error stating the if function has invalid arguments.

With({
   personImage: Office365Users.UserPhotoV2(ThisItem.Mail),
   hasphoto: Office365Users.UserPhotoMetadata(ThisItem.UserPrincipalName).HasPhoto 
    },
    If (
    hasphoto,
    personImage,
    user
)
)
2
  • Where are you adding this formula, on which property and what type of control you used? Commented Oct 13, 2022 at 14:34
  • I had inserted a vertical gallery. The text results are coming from 365 user. I clicked on the sample image and the in fx for image I put the code from above. If I remove user it will work but displays nothing for users who don't have a photo. Commented Oct 13, 2022 at 16:04

1 Answer 1

0

Try using this formula in "Image" property of image control:

If (
    Office365Users.UserPhotoMetadata(ThisItem.UserPrincipalName).HasPhoto,
    Office365Users.UserPhotoV2(ThisItem.Mail),
    User().Image
)

OR:

With(
    {
        personImage: Office365Users.UserPhotoV2(ThisItem.Mail),
        hasphoto: Office365Users.UserPhotoMetadata(ThisItem.UserPrincipalName).HasPhoto 
    },
    If (
        hasphoto,
        personImage,
        User().Image
    )
)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.