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

Error: Office365Users - User Photo

Hi,

 

I have this code in a picture control:

Office365Users.UserPhoto(Office365Users.MyProfile().Id)

 

But, if an user does not have an image, the following error is returned:

The service returned an error: Office365Users!UserPhoto: The server returned an 404 error (NotFound).

 

error.png

 

 

 

 

 

 

 

 

 

Is there any way to validate if an user has an image before calling the respective method?

 

Thanks,

Rui Barbosa

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Dirk
Level: Powered On

Re: Error: Office365Users - User Photo

try using the "HasPhoto" metadata property of Office365Users.UserPhotoMetadata

 

I implemeted it like this:

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

View solution in original post

18 REPLIES 18
KC
Level 8

Re: Error: Office365Users - User Photo

Hi Rui,

There is no UserPhoto function on the Office365Users connector in my tenant but I just use for the current user

 

 User().Image

 

Hope this helps.

RuiBarbosa
Level: Powered On

Re: Error: Office365Users - User Photo

Hi @KC,

 

The problem of User().Image is that for some persons, especially, people that have changed your image recently, the image doesn't appear.

Community Support Team
Community Support Team

Re: Error: Office365Users - User Photo

Hi @RuiBarbosa,

 

Based on what I know, currently there is no way to check the data within PowerApps.

The user photo is stored under AAD, which you could change through the AAD users and groups.

And AAD currently is using the same way as Office 365 users to query the data, so if the service receives an error of value not found, it will just display in PowerApps.

And the error message will stay once the call has been made, currently I have no workarounds to deal with that.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Dirk
Level: Powered On

Re: Error: Office365Users - User Photo

try using the "HasPhoto" metadata property of Office365Users.UserPhotoMetadata

 

I implemeted it like this:

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

View solution in original post

gvraaij
Level: Powered On

Re: Error: Office365Users - User Photo

I used the following formula, which workes like a charm:
If(Office365Users.UserPhotoMetadata(ThisItem.Id).HasPhoto=false,SampleImage,Office365Users.UserPhoto(ThisItem.Id))

ngabougaifan
Level: Powered On

Re: Error: Office365Users - User Photo

Hi gvraaij

Could you explain in detail on where to replace the formula to resolve the 404 error ? Thank you
gvraaij
Level: Powered On

Re: Error: Office365Users - User Photo

Hi ngabougaifan, of course. No problem.

 

 

1-3-2018 12-30-59.jpg

ngabougaifan
Level: Powered On

Re: Error: Office365Users - User Photo

Many thanks !

ngabougaifan
Level: Powered On

Re: Error: Office365Users - User Photo

hi gvaarij

 

I have replaced all the function for Image control with yellow triangle error and managed to get rid of it. However, this error pops out when i tried to run the app. Any idea of how to resolve this issue? Thank you.

28642981_10155029232356582_578934143_o.png

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,046)