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).
Is there any way to validate if an user has an image before calling the respective method?
Thanks,
Rui Barbosa
Solved! Go to Solution.
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))
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
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))
I used the following formula, which workes like a charm:
If(Office365Users.UserPhotoMetadata(ThisItem.Id).HasPhoto=false,SampleImage,Office365Users.UserPhoto(ThisItem.Id))
Hi ngabougaifan, of course. No problem.
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.
User | Count |
---|---|
251 | |
102 | |
94 | |
47 | |
37 |