PowerApps: Display the created by user’s profile picture in the display form

PowerApps: Display the created by user’s profile picture in the display form

Someone reached out to me for help displaying the profile picture of the user who created the item, in the display form. Simple to implement but I saw some posts asking for help on this but no answer posted so I figured I would post the solution. So here is the solution:

  1. On the View tab, select Data connections and add a new data connection to Office 365 Users
  2. If the Author field does not have a DataCard in your form, then add it.
    • Select the details form, on the left menu, then select the Data source on the right
    • A screen will open with all your fields that have data cards, tick created by and a data card will be created for it
  3. Add an Image control in the DataCard for the CreateBy field – this is important otherwise it wont work- check your path at the bottom of the screen to ensure you are adding the image in the Data Card.
  4. Set the default value to Office365Users.UserPhoto(ThisItem.Author.Email)
  5. When you view your item, the image will display in the Created By data card
  6. If you want the user’s image to not be restricted to the Author Data Card zone, then you can add the image field outside of the Data card and set the default value to this formula:
    • Replace DataCardValue5 with the Data Card Value name of your Author field
    • Formula: If(Office365Users.UserPhotoMetadata(First(Office365Users.SearchUser({searchTerm:DataCardValue5.Selected.DisplayName})).Id).HasPhoto=true;Office365Users.UserPhoto(First(Office365Users.SearchUser({searchTerm:DataCardValue5.Selected.DisplayName})).Id); SampleImage)
    • Note: You still need to O365 user connection and the Author Data Card (does not need to be visible)