One of the most common questions Power Apps developers ask is: Should I use User() or Office365Users()?
At first glance, both functions seem similar because they provide information about users. However, they serve different purposes and understanding when to use each one can improve your app's performance, reliability, and user experience.
In this article, we'll explore the differences between User() and Office365Users(), their strengths and limitations, and the scenarios where each is most appropriate.
Understanding the User() Function
The User() function is a built-in Power Apps function that returns basic information about the currently signed-in user.
Available Properties
User().FullName
Returns the display name of the current user.
User().FullName
User().Email
Returns the email address (User Principal Name) of the signed-in user.
User().Email
User().Image
Returns the profile picture of the current user.
User().Image
Why Use User()?
The User() function is often the best choice when you only need information about the person currently using the app.
Benefits:
Fast and lightweight
No connector required
No additional permissions needed
Works well in offline scenarios
Simple to implement
Limitations
Only returns information about the logged-in user
Cannot retrieve details about other employees
Profile images may be unavailable in some environments
Understanding the Office365Users() Connector
The Office365Users connector provides access to Microsoft 365 directory information. Unlike User(), it can retrieve information about other users within your organization.
Before using it, you must add the Office 365 Users connector to your app.
Common Functions
Get Your Own Profile
Office365Users.MyProfile()
Returns detailed profile information for the current user.
Get Another User's Profile
Office365Users.UserProfileV2("john.doe@company.com")
Returns profile information for a specific user.
Search for Users
Office365Users.SearchUser({searchTerm:"John"})
Searches the Microsoft 365 directory for matching users.
Retrieve a User's Photo
Office365Users.UserPhoto("john.doe@company.com")
Returns the profile picture of a specific user.
Get Direct Reports
Office365Users.DirectReports("manager@company.com")
Returns a list of employees who report to a manager.
Why Use Office365Users()?
The connector is useful whenever your app needs information beyond the currently logged-in user.
Common use cases include:
Employee search functionality
Organizational directories
Displaying job titles and departments
Finding managers and reporting structures
Showing profile photos for multiple users
Considerations
Requires the Office 365 Users connector
May require additional permissions depending on your environment
Slower than
User()because it makes API callsSome functions are subject to delegation and record limitations
Requires an internet connection
User() vs Office365Users(): Quick Comparison
| Requirement | Recommended Option |
|---|---|
| Current user's name or email | User() |
| Current user's profile photo | User() |
| Search for employees | Office365Users() |
| Retrieve job title, department, or manager | Office365Users() |
| Display organizational hierarchy | Office365Users() |
| Offline-friendly apps | User() |
| Best performance | User() |
| Access company directory data | Office365Users() |
Performance Best Practices
When building production apps, consider these recommendations:
Use User() Whenever Possible
If all you need is the logged-in user's information, avoid using Office365Users(). The built-in User() function is significantly faster and reduces unnecessary API calls.
Cache Office365Users() Data
If you need directory information repeatedly, store the results in variables or collections to reduce connector calls.
Example:
Set(varManager, Office365Users.Manager(User().Email))
Avoid Repeated Connector Calls
Calling Office365Users() inside galleries or frequently refreshed controls can impact app performance. Retrieve the data once and reuse it where possible.
Conclusion
Although User() and Office365Users() both provide user information, they are designed for different purposes.
Use User() when you only need details about the currently signed-in user. It is fast, simple, and requires no additional setup.
Use Office365Users() when you need access to organizational data such as employee profiles, managers, departments, profile photos, or user searches.
Choosing the right function for the right scenario will help you build Power Apps that are faster, more efficient, and easier to maintain.
forum Discussion (0 comments)
Join the Discussion
Login to share rich-text comments and reply to other members.
No comments yet. Be the first to share your thoughts!