I am a newbie to PowerApps, but have created a basic app connecting to a SharePoint Online data source.
The datasource has a SharePoint list with a Poeple picker field in it.
I have embedded a gallery on a form to show the User's Picture from the Office365Users Connector.
The code I am using is If(Office365Users.UserPhotoMetadata(ThisItem.Email).HasPhoto=false,SampleImage,Office365Users.UserPhoto(ThisItem.Email))
I am unable to see any User's Pictures ?
I have also tried the UserPhotov2 property to no avail...
HasPhoto property seems to result to "False", but all the users concerned have photos in AAD / Office 365, even my own profile which the connector is using?
The Email addresses are correct and are identical to their UserPrincipalName attribute...
Please can you help me find the missing piece of the puzzle? I guess there is something obvious I have missed?
This is the formula that works for me
Its essentially the same as yours, but I made sure to use UPN not email. You may have users that don't have emails in their profile.
Thanks for the info...
I am using a SharePoint Online List as the source of date, with a people picker field in it, so don't have the UserPrincipalName attribute to hand, only the Email attribute. Although I have tried using Office365Users.SearchUser to get the UPN from the email and then use the UPN for the id for the UserPhoto / UserPhotoV2 calls, but still no joy.
I have even tried hardcoding a UPN, but same result...
The wierd thing is I get no errors, just a blank picture, so looks like it is finding something, but picture just won't display?
I have also output the result to a text field and get a link such as "appres://blobmanager/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/xx", so the code seems to be working?
We are in a Hybrid environment with 365, so have Azure AD Sync / ADFS with on-premise AD as the source.
Could it be related to this?
If you are in a hybrid environment then double check with your domain admins to make sure that user's email is equal to their UPN. Usually it is, but its not guaranteed.
Then I'm not sure why its not working for you. As you can see from my example I'm using essentially the same formula you are and it works for me.
I have spotted another similar case on the forums yesterday and they also have a hybrid O365 setup with Exchange On-Premise.
I think this has something to do with it. Not sure why, but I guess it is just not possible in this scenario ;-(
I am going to put in a workaround and have a list of user's and images within the App to do a lookup on...
Thanks for all your help...
If you are using Exchange On-premises then that is probably where the problem is coming from. User Profile pictures are synced from AD using Exchange on-line. If you aren't using that then I expect something isn't registering correctly in terms of the pictures and that's why the HasPhoto in user metadata works for me but not for you.
I agree. Would just have been nice to have something from MS to state this is the case though. Unable to find anything in their documentation suggesting this. Can see the user's pictures in SharePoint Online, AzureAD and Office 365 portals fine 😉 Anyway, wasted enough time on this already, time for a custom workaround I think. Thanks for your assistance and hope this post assists other people in the same situation...
Check it out!
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
The largest Power BI, Power Platform, and Data conference in New Zealand