cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mrQ
Helper V
Helper V

Office365UsersUser.PhotoMetadata Authentication Error?

Hey there

 

Our users are getting the following error by using Office365Users.UserPhotoMetadata().HasPhoto

 

 

Office365Users.UserPhotoMetadata failed: { "error": { "code": "AuthenticationError", "message": "Error authenticating with resource", "innerError": { "date": "2020-08-31T10:16:13", "request-id": "<GUID>" } } }

 

 

I've read in this thread about it, but by reading the final answer it basically means it is useless in PowerApps and I don't really believe that.

 

Anyone knows how to overcome this issue?

 

** Edit **

This is the formula I'm using for PhotoMetadata:

 

If(!IsBlank(txtSearchAttendees.Text) && Not(IsBlank(ThisItem.Id)) && Office365Users.UserPhotoMetadata(ThisItem.Id).HasPhoto,
    Office365Users.UserPhoto(ThisItem.Id),
    'default-profile'
)

 

6 REPLIES 6
ganeshsanap
Super User
Super User

@mrQ Can you please add the formula you used in your app to your question? It will be helpful for us to answer your question.

Of course. I'll add it to my initial post as well. Here you go:

If(!IsBlank(txtSearchAttendees.Text) && Not(IsBlank(ThisItem.Id)) && Office365Users.UserPhotoMetadata(ThisItem.Id).HasPhoto,
    Office365Users.UserPhoto(ThisItem.Id),
    'default-profile'
)

 

@mrQ What values you have in ThisItem.Id ?

Office365Users.UserPhotoMetadata() method expects "User principal name or email id" of user. Make sure you are passing one of these as a parameter to Office365Users.UserPhotoMetadata(). Check below documentation:

Get user photo metadata 


Please click Accept as solution if my post helped you solve your issue. This will help others find the correct solution easily. It also closes the item. If the content was useful in other ways, please consider giving it 👍

 

v-yutliu-msft
Community Support
Community Support

Hi @mrQ ,

Could you tell me "ThisItem.Id" represent what? what is your data source?

If it is sharepoint list, then I know the reason.

I've found a similar issue for your reference:

https://powerusers.microsoft.com/t5/Building-Power-Apps/Office365Users-UserPhoto-AuthenticationError...

The reason the images would not show are usually because the URL that is used to get the image is a url to the actual site on SPO.

When PowerApps binds an Image control to this URL, the request for the image is NOT authenticated.

Only URLs that come from supported data types from within the SharePoint connector get rewritten so that PowerApps will be able to authenticate them safely.

 

 

Best regards,

 

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yutliu-msft 
@ganeshsanap 
Thanks for your responses.

 

@v-yutliu-msft 
The link you provided is the one I linked to in my initial post.

 

As for the ThisItem.Id it is referring to its gallery with the data source of Office365Users:

If(!IsBlank(txtSearchAttendees.Text), Office365Users.SearchUser({searchTerm:Trim(txtSearchAttendees.Text), top: 50}))

 If I change ThisItem.Id to ThisItem.Mail it still won't work, I'm afraid.

v-yutliu-msft
Community Support
Community Support

Hi @mrQ ,

I've made a similar test but not met the same problem like your description.

Here's my test for your reference:

1)connect with office365 users

2)set the gallery's Items:

If(!IsBlank(txtSearchAttendees.Text), Office365Users.SearchUser({searchTerm:Trim(txtSearchAttendees.Text), top: 50}))

3)set the image's Image(inside the gallery):

If(!IsBlank(txtSearchAttendees.Text) && Not(IsBlank(ThisItem.Mail)) && Office365Users.UserPhotoMetadata(ThisItem.Mail).HasPhoto,
    Office365Users.UserPhoto(ThisItem.Mail)
)

 or 

If(!IsBlank(txtSearchAttendees.Text) && Not(IsBlank(ThisItem.Id)) && Office365Users.UserPhotoMetadata(ThisItem.Id).HasPhoto,
    Office365Users.UserPhoto(ThisItem.Id)
)

Both of them work good.

923.PNG

 I suggest you try to recreate connection with office365 users.

If the problem still exists, please open a ticket here:

https://powerapps.microsoft.com/en-us/support/pro/ticket/

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (17,510)