Forum Discussion

PerfPC's avatar
PerfPC
Copper Contributor
Feb 17, 2022
Solved

PowerApps Profile Pic IF statement

Hi All,   I've currently got a SP list with a people field showing the users profile picture. In PowerApps I've a gallery to display all my columns including the profile picture with the below code...
  • ekarim's avatar
    Feb 18, 2022

    PerfPC 

    Office365Users.UserPhotoMetadata().HasPhoto

    will return true or false. You can use this in an If condition:

     

    If(
    Office365Users.UserPhotoMetadata(Gallery1.Selected.Mail).HasPhoto,
    Office365Users.UserPhoto(Gallery1.Selected.Mail),
    'robot-face'
    )

     

     

     

    To use the sample image use:

     

    If(
        Office365Users.UserPhotoMetadata(Gallery1.Selected.Mail).HasPhoto,
        Office365Users.UserPhoto(Gallery1.Selected.Mail),
        SampleImage
    )

     

     

    Hope this helps.

     

    Ellis

Resources