web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Office365UsersUser.Pho...
Power Apps
Unanswered

Office365UsersUser.PhotoMetadata Authentication Error?

(0) ShareShare
ReportReport
Posted on by 482

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'
)

 

Categories:
  • ganeshsanap Profile Picture
    1,555 on at

    @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.

  • mrQ Profile Picture
    482 on at

    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'
    )

     

  • ganeshsanap Profile Picture
    1,555 on at

    @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 Profile Picture
    Microsoft Employee on at

    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/td-p/267431

    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,

     

     

  • mrQ Profile Picture
    482 on at

    @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 Profile Picture
    Microsoft Employee on at

    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,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 320

#3
Mohsin Ali Profile Picture

Mohsin Ali 246

Last 30 days Overall leaderboard