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 / Practices for retrievi...
Power Apps
Answered

Practices for retrieving data from Office365Users.MyProfile() once and using it through the PowerApp

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I noticed that whenever I use Office365Users.MyProfile() function it makes calls every time I uses it, and I do use it quite a lot in my application (like on every screen few times). That slows down my app as every time it asks for same information and wait until it loads. I was wondering is it possible to call Office365Users.MyProfile() function once the App is launched and reuse that info through the app without calling it ever again (or keeping it while the users session is active so that it connects to Office365 network only once per user session). Is there any practices of how to create temporary variables which keep their record for individual sessions while the users is using the App?

 

I am looking for something like this:

On App Launch:

UsersProfile() = Office365Users.MyProfile();

And then instead of using Office365Users.MyProfile()

I could use UserProfile() instead which is local variable and does not connect to external data every time.

Any other tips for improving efficiency also welcome! Thanks!

Categories:
  • Verified answer
    carlosag Profile Picture
    Microsoft Employee on at

    The best way for me is using Context Variables. Basicailly you would do is add in the OnVisible of the first screen something like:

    UpdateContext({UserProfile: Office365Users.MyProfile()})

    From then on in that screen you can bind Labels to UserProfile.Mail, or UserProfile.DisplayName, etc.

     

    If you need the same data in another screen, then when calling Navigate you can pass the context using the third argument like:

    Navigate(Screen2, ScreenTransition.Fade, {UserProfile: UserProfile})

    Then in that screen you will have UserProfile as well.

     

    Another option if you don't like passing the context across screens is collecting it into a Collection since those are global, however it will be tedious and not very performant to do LookUp formulas like: LookUp(Globals, Name = "Profile").Value.DisplayName

     

    So I would recommend using Context Variables as above. We are looking at supporting Global variables that will allow you to do something similar and not require to pass them through Navigate, but that is still not available.

     

     

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

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard