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.
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:
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.
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.
Fill out a quick form to claim your user group badge now!
Find out where you can attend!
Features releasing from October 2019 through March 2020
Learn how to build the business apps that you need.