web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : aCMP67efHKe1qQ9+gkQsHc
Power Apps - Building Power Apps
Answered

Displaying phone number for a given user

Like (0) ShareShare
ReportReport
Posted on 10 Nov 2021 19:39:11 by 12

Hi there,

 

Hitting a real wall with this. I'm worried there's no way, but hopefully someone can help. I'm creating an employee directory using a basic gallery with a SharePoint list as a data source. I've gotten name, email, and department to display without issue for each item in the gallery. However, when I attempt to get the phone number showing as well, it doesn't seem possible.

 

Microsoft docs and every other tutorial on employee directories either assume you only want the current user's information, or they seem to imply that the Office365Users.UserProfile() function cannot work unless you type an email address in directly, but that wouldn't work at all for a gallery that's populating from SP. I consistently run into the "this formula doesn't support scope" no matter how I try to work around the issue. To be clear, this is the code I'm trying to use in the field I want to show the phone number: 

 

 

 

 

Office365Users.UserProfileV2(ThisItem.Name.Email).businessPhones

 

 

 

 

It seems like it should work, the logic makes sense to me. Any help is greatly appreciated.

 

edit: just to clarify this is the guide I tried to follow by MSFT: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/connections/connection-office365-users

 

But it assumes one would be manually entering the UPN string into the function and not referencing it within a gallery.

 

final edit: @Jeff_Thorpe had the answer! I used this code in the Label's text property where I wanted the mobile number to show:

 

 

First(Office365Users.UserProfileV2(ThisItem.Name.Email).businessPhones).Value

 

 

This produced errors regarding not finding the user(s) but they are safe to ignore.

Categories:
I have the same question (0)
  • jessevanatta Profile Picture
    12 on 10 Nov 2021 at 21:27:28
    Re: Displaying phone number for a given user

    EDIT: Jeff, your code works! I mistakenly thought it was not due to several entries without numbers at the top of my gallery, but scrolling through proves that the mobile number is being pulled as expected. THANK YOU!!

     

    old text below

    -------------

     

     

    I ended up with this error and no data coming through (sounds like you got data showing despite errors?):

    phone powerapps.png

     

    Unsure where to go from here. I've tried to use AddColumn to create "PhoneString", with the idea that something could pull the phone data from the profile and append it to the text field, but this hits the same wall (scope not supported). I used AddColumn to create a DisplayName text column that works perfectly with the Gallery, but this works because the name properties are readily available in the People picker components. Why in the world is phone number not a part of the People picker?! I can't see any helpful reason to keep that information locked in a different connector and therefor inaccessible by some of these basic functions and components....

  • Verified answer
    Jeff_Thorpe Profile Picture
    6,085 Super User 2024 Season 1 on 10 Nov 2021 at 20:35:01
    Re: Displaying phone number for a given user

    This gave me the expected results but with an error which is a little confusing.

    First(Office365Users.UserProfileV2(ThisItem.Name.Email).businessPhones).Value)

  • jessevanatta Profile Picture
    12 on 10 Nov 2021 at 20:06:48
    Re: Displaying phone number for a given user

    I'm trying one alternate way to get the data there, but still not reaching success. I created an additional People/Group column in the SP list that displays only the phone number, and my trouble is still referencing that bit of data from PowerApps at all.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Tom Macfarlan – Community Spotlight

We are honored to recognize Tom Macfarlan as our Community Spotlight for October…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 752 Most Valuable Professional

#2
developerAJ Profile Picture

developerAJ 472

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 358 Super User 2025 Season 2

Last 30 days Overall leaderboard
Loading complete