cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
GACW
Level: Power Up

Handling error messagen when an O365 user doesn’t have a photo.

Hello,

 

I have done a PowerApp that shows a profile of an Office 365 User.

 

It shows this information:

 

  • Name.
  • Telephone.
  • Email.
  • Photo.
  • Other kind of data.

All data comes from AD except the Photo that the user can upload it he or she wants. This gives me a problem because if the user doesn´t upload it the power app gives the user an error message in bright red.

I can’t allow it to appear but I don’t find any function/formula to capture it before appearing in the screen. Looking in the forum I have tried this formula:

 

If(!IsBlank( ThisItem.CorporateUser.Picture); Set(vEmpty;"NO"); Set(vBl vEmpty anco;"YES"))

 

  • CorporateUser is an Office365 SharePoint User Field.
    • Before accessing the profile screen I filter a SharePoint list and get this Filed (it is never a group, always a user)

The vEmpty variable is always “NO”, even when the user has not uploaded a pic.

 

After this formula has been executed I have this One (The one thas gives the error when the user doesn’t have a pic):

 

UsuariosdeOffice365.UserPhoto(UsuariosdeOffice365.UserProfile(CorporateUserEmail).Id)

 

My plan is to create a formula that, depending on the value of vEmpty shoes the user photo or a sample image (when the user doesn’t have one) because right now it shows errors in the screen (and when there is more than an image element all screen gets red with error messages). I will combine both formulas.

 

Could anyone give me any help/idea? I don’t mind if its correcting the first formula I worte ( If(!IsBlank….) or any other solution.

 

Thank You!

GACW

2 REPLIES 2
Community Support Team
Community Support Team

Re: Handling error messagen when an O365 user doesn’t have a photo.

Hi @GACW,

 

Try with below formula to see if this would work:

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

Notice that even though the app works fine, the 404 errors are annoying and don't make a good experience. MS is already awared of this issue. 

 

For your reference:

https://powerusers.microsoft.com/t5/General-Discussion/Shoutouts-error/m-p/69675/highlight/true#M285...

 

Regards,

Mona

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
GACW
Level: Power Up

Re: Handling error messagen when an O365 user doesn’t have a photo.

Thank you, I am going to try it and tell about it.

 

I didnt find that post when I searched, thank you again Smiley Happy