cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
thanke
Level: Powered On

How do I use the the Office365Users."UserPhoto" option and what is the syntax for this.

I am trying to pull in user photos from O365 into a PowerApp and noticed that if I connect to the Office365Users data connection there  is a "UserPhoto" option you can select from the drop down but I can't seem to figure out the needed syntax.

 

Thanks,

Todd

 

1 ACCEPTED SOLUTION

Accepted Solutions
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: How do I use the the Office365Users."UserPhoto" option and what is the syntax for this

The UserPhoto function on the Office365Users connector needs the id of the user for which you want the picture. There are a few ways you can get that:

  • If you want your own picture, you can use the MyProfile() function: Office365Users.UserPhoto(Office365Users.MyProfile().Id)
  • If you want the pictures for someone else, you can use any of the functions that return the users. For example, you can use Office365Users.SearchUser({searchTerm:"John Doe"}), and that will return a table with all users that match that name. If you set that expression to a Gallery's Item property, then within the gallery template you can have an image control with its Image property set to Office365Users.UserPhoto(ThisItem.Id)

View solution in original post

4 REPLIES 4
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: How do I use the the Office365Users."UserPhoto" option and what is the syntax for this

The UserPhoto function on the Office365Users connector needs the id of the user for which you want the picture. There are a few ways you can get that:

  • If you want your own picture, you can use the MyProfile() function: Office365Users.UserPhoto(Office365Users.MyProfile().Id)
  • If you want the pictures for someone else, you can use any of the functions that return the users. For example, you can use Office365Users.SearchUser({searchTerm:"John Doe"}), and that will return a table with all users that match that name. If you set that expression to a Gallery's Item property, then within the gallery template you can have an image control with its Image property set to Office365Users.UserPhoto(ThisItem.Id)

View solution in original post

rhysg
Level: Powered On

Re: How do I use the the Office365Users."UserPhoto" option and what is the syntax for this

I have tried this solution with Office365Users.UserPhoto(ThisItem.Id) but I get the following error The server returned with a HTTP error code 404. All the other Information is showing correctly though, just not the picture.

 

**Edit: I Believe this error shows for users that dont have a image selected. It appears to be working for users that have chosen an image. A decent work around is:

 If(Office365Users.UserPhotoMetadata(ThisItem.Id).HasPhoto=false,SampleImage,Office365Users.UserPhoto(ThisItem.Id))

Shamprasadrh
Level: Powered On

Re: How do I use the the Office365Users."UserPhoto" option and what is the syntax for this

I have the same problem but the solution does not seems to be working. 

 

below is the formula I am using. 

 

If(Office365Users.UserPhotoMetadata(Office365Users.MyProfile().Id).HasPhoto=false,SampleImage, Office365Users.UserPhoto(Office365Users.MyProfile().Id))
Anonymous
Not applicable

Re: How do I use the the Office365Users."UserPhoto" option and what is the syntax for this

Hello,

I got the same error,but don't know where to change the funtion.

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,856)