cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Adding users Office365 profile picture to PowerApp

I created an Office Directory in PowerApps using a Sharepoint list as the data source. It works as expected listing all our employees and their contact information. Now, I'd like to add their Office365 profile picture next to their information. I found a ton of suggestions online but none seem to work. I have Office365 listed as a data source. I was able to successfully create a new app from a blank canvas and then add a new screen using the People template and that successfully displayed the users pictures but I can't get it to work in the app that has the Sharepoint list data in it. Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Adding users Office365 profile picture to PowerApp

Hi @GLH ,

Do you want to save image from office365 profile to sharepoint list?

Since the image saved in office365 profile is saved as binary, so it's not supported to save it to picture field, hyperlink field or Attachments in sharepoint list.

I suggest you save the images to multiple line of text type in sharepoint list.

I've made a similar test for your reference:

1)insert a person field for choosing person, a multiple line of text type for saving this user's office365 photo.

3206.PNG

 

2)customize the sharepoint form:

connect this form with Office365 Users to get photo and update photo

3207.PNG

 

Unlock the photo field

Insert an addpicture control to display current user's photo and choose photo to update

set the UploadedImage1's Image:

If(IsBlank(AddMediaButton1.Media), 
   If(IsBlank(DataCardValue2.Selected),SampleImage,
      Office365Users.UserPhotoV2(DataCardValue2.Selected.Email)), 
   AddMediaButton1.Media)

//when you not choose any photo in this control, it will display the selected user's profile photo.

if you choose any photo in this control, it will display the selected photo.

set the AddMediaButton1's OnSelect:

Set(var,true)

set the photo textinput's Default:

If(var,AddMediaButton1.Media,Office365Users.UserPhotoV2(DataCardValue2.Selected.Email))

 //if you not choose any new photo in the addpicture control, the textinput will display the original photo's binary

3208.PNG

 

Then in SharePointIntegration's OnSave:

SubmitForm(SharePointForm1);Office365Users.UpdateMyPhoto("image/jpeg",DataCardValue3.Text)
//DataCardValue3 is the photo field textinput name

//then you could update the user profile photo.

3200.gif

 

 

In this way, if you choose any user in person field, the photo field will display the user profile's photo. If you choose any other photo in the photo field and save, you could update the selected user's profile's photo.

 

 

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.

View solution in original post

4 REPLIES 4
Highlighted
Super User
Super User

Re: Adding users Office365 profile picture to PowerApp

Hi @GLH 

 

What error do you get if you try and display the pictures in the app with the SharePoint list? Are the Names\Email addresses of the people who you want to display the pictures for listed in a SharePoint list?

 

Here is a video that discusses this topic, please let me know if you don't come right.

 

https://youtu.be/rcrubFa8758

 

Dawid van Heerden
Follow on Twitter: @davestechtips
Subscribe to YouTube: https://www.youtube.com/davestechtips?sub_confirmation=1
**If you found this reply helpful, please like it and mark this as the answer to close the topic and make it easier to find for other people with similar questions. AND we get points for it 😉

Highlighted
Community Support
Community Support

Re: Adding users Office365 profile picture to PowerApp

Hi @GLH ,

Do you want to save image from office365 profile to sharepoint list?

Since the image saved in office365 profile is saved as binary, so it's not supported to save it to picture field, hyperlink field or Attachments in sharepoint list.

I suggest you save the images to multiple line of text type in sharepoint list.

I've made a similar test for your reference:

1)insert a person field for choosing person, a multiple line of text type for saving this user's office365 photo.

3206.PNG

 

2)customize the sharepoint form:

connect this form with Office365 Users to get photo and update photo

3207.PNG

 

Unlock the photo field

Insert an addpicture control to display current user's photo and choose photo to update

set the UploadedImage1's Image:

If(IsBlank(AddMediaButton1.Media), 
   If(IsBlank(DataCardValue2.Selected),SampleImage,
      Office365Users.UserPhotoV2(DataCardValue2.Selected.Email)), 
   AddMediaButton1.Media)

//when you not choose any photo in this control, it will display the selected user's profile photo.

if you choose any photo in this control, it will display the selected photo.

set the AddMediaButton1's OnSelect:

Set(var,true)

set the photo textinput's Default:

If(var,AddMediaButton1.Media,Office365Users.UserPhotoV2(DataCardValue2.Selected.Email))

 //if you not choose any new photo in the addpicture control, the textinput will display the original photo's binary

3208.PNG

 

Then in SharePointIntegration's OnSave:

SubmitForm(SharePointForm1);Office365Users.UpdateMyPhoto("image/jpeg",DataCardValue3.Text)
//DataCardValue3 is the photo field textinput name

//then you could update the user profile photo.

3200.gif

 

 

In this way, if you choose any user in person field, the photo field will display the user profile's photo. If you choose any other photo in the photo field and save, you could update the selected user's profile's photo.

 

 

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.

View solution in original post

Highlighted
New Member

Re: Adding users Office365 profile picture to PowerApp

I was able to figure out a real simple way to accomplish this over the weekend.  My powerapp has two data sources; Sharepoint and Office365.  A Sharepoint list pulls in all the data in the fields. The employee picture loads from the user's Outlook profile, based on their email address.  I did it this way because all the lines of sample code I found would not consistently pull the picture from their Office365 profile. 

 

If you click on the frame that is used for holding the picture and use the line of code below, it works every time:

 

If(!IsBlank(ThisItem.ID),Office365Users.UserPhotoV2(ThisItem.'eMail Address'))

Highlighted
Helper II
Helper II

Re: Adding users Office365 profile picture to PowerApp

Hi GHL,

 

am also having sharepoint list and office365 user data source, I have used 

Office365Users.UserPhoto(Office365Users.MyProfileV2().id)

Am getting error profile_PictureError.png

 

Could you pls help me

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,446)