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 / Show Office profile pi...
Power Apps
Answered

Show Office profile pic from name in Excel

(1) ShareShare
ReportReport
Posted on by 26

Hi!

 

I'm building an app that takes rows from an Excel file depending on some filters. The rows in the Excel contain names that more or less matches the names in their respective Office 365 profiles. This info is displayed in a gallery, and I want to create a connection where each entry in the gallery with information from the Excel gets the profile picture from the username that matches the name in the Excel file, but I haven't been able to find any answer that works. My gallery has the following fields:

image.png

 

Thanks in advance!

Categories:
I have the same question (0)
  • Verified answer
    KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    Hi @JoelAle,

     

    User profile photos can be obtained using the following code, where locEmployeeName is the employee name:

    Office365Users.UserPhotoV2(First(Office365Users.SearchUserV2({searchTerm:locEmployeeName}).value).Id)

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    Follow me online.

  • JoelAle Profile Picture
    26 on at

    Thanks! It works, kind of... I get error The method 'UserPhotoV2' has an invalid value for parameter 'id'. Can it be that some of the names don't match any profile? Or maybe that some of the accounts don't have any picture?

  • JoelAle Profile Picture
    26 on at

    Apparently, some of the names in the Excel file have some extra information which makes the app crash sometimes. Your code worked properly. Thanks!

  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    My pleasure! Yes, think I've seen that before if Id is blank or not recognised.

     

    Error handling using the IfError function (or similar) is worth looking into: https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-iferror


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    Follow me online.

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 474

#1
Valantis Profile Picture

Valantis 474

#3
WarrenBelz Profile Picture

WarrenBelz 375 Most Valuable Professional

Last 30 days Overall leaderboard