cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RuiBarbosa
Helper I
Helper I

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
Advocate III
Advocate III

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

19 REPLIES 19
KC
Kudo Kingpin
Kudo Kingpin

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.

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.

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
Advocate III
Advocate III

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
Frequent Visitor

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

ngabougaifan
Advocate I
Advocate I

Hi gvraaij

Could you explain in detail on where to replace the formula to resolve the 404 error ? Thank you

Hi ngabougaifan, of course. No problem.

 

 

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

Many thanks !

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,273)