cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Techie1123
Level: Powered On

Using Office365Users with Metadata field error

Hello everybody, 

 

I'm having some issues after reading several posts and researching online, (first time app maker). Im creating an app and would like it to display the logged in users profile picture. Here is the code I used:

 

If(Office365Users.UserPhotoMetadata(Office365Users.MyProfile().Id).HasPhoto = false,'generic-user-profile',Office365Users.UserPhoto(Office365Users.MyProfile().Id))

 

I do not get any errors in the online studio but, when using on the mobile powerapps, I get 2 errors: 

"Office365Users.UserPhotoMetadata failed: The method 'UserPhotoMetadata' has an invalid value for parameter 'userId' "

"Office365Users.UserPhoto failed: The method 'UserPhoto' has an invalid value for parameter 'userId'  "

 

I honestly have no idead how to get this information to display without an error. The information displays but the error pops up on the mobile devices and doesn't look good. I've tried all possible combinations on a separate screen using text boxes to display just the user id and then pulling the photo information, it works but still shows the error. Does anybody else have any ideas feel like im hitting a wall. 

5 REPLIES 5
Ahmed_Moussa
Level: Powered On

Re: Using Office365Users with Metadata field error

Hi, have you got a resolution for this issue just yet ?

Techie1123
Level: Powered On

Re: Using Office365Users with Metadata field error

Sure, Don't.  

 

I have been redoing the whole app trying to find a way around this issue.

Highlighted
flipcritic
Level: Powered On

Re: Using Office365Users with Metadata field error

I've got this same problem. Were you able to find a way around it?

Techie1123
Level: Powered On

Re: Using Office365Users with Metadata field error

Still waiting to find a solution or someone more knowledgable than me with powerapps.  I found a workaround that is working for the time being. There are several places in the app that I am using this functionality. The first is a picture of the current user on the app, like you are signed in. 

 

Here is the code I am using:

Office365Users.UserPhotoV2(User().Email)

On the others like a contact list, I was unable to use the IF statement like I wanted to and use a placeholder picture if they did not have one in the AD. So I made my users insert a blank photo themselves into their account, sorta out of the way and not the way I would do it. But it was a workaround nonetheless. So...for my contacts list of members in the office I used a gallery linked to a sharepoint list with the contact info, as for the picture on each I just had the code look for the user in the active directory by email. I made a small box (hidden) with their email. 

 

Code:

Office365Users.UserPhotoV2(First(Office365Users.SearchUser({searchTerm:ThisItem.Email_x0020_Address})).UserPrincipalName)

Hope this helps, I am still going to keep this open cause I would like to find a way to make this work.  Might run into the what if senario down the road of " I cannot access these workers and need them to change their AD picture" It'd be nice to do this on the fly without their knowledge.

Administrator
Administrator

Re: Using Office365Users with Metadata field error

Hi Everyone,

 

Please review the following blog post and let me know if it's helpful. 

 

@TopShelf-MSFT 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 333 members 5,202 guests
Please welcome our newest community members: