PowerApps - Office 365 Users Connector

Let’s explore how you can leverage the Office 365 Users connector in Power Apps to access user profiles and retrieve information. This connector allows you to interact with user data within your organization using your Office 365 account. Here are the steps:

  1. Adding the Office 365 Users Connector:

    • In Power Apps, go to the Connections tab.
    • Search for Office 365 Users and add it as a connection.
    • Sign in with your work account if prompted.
  2. Using the Connection in Your App:

    • Once the connection is added, you can perform various actions related to user profiles:
      • Retrieve your own profile information (e.g., name, email, photo).
      • Get details about other users (e.g., their department, job title, phone number).
      • Access a user’s manager or direct reports.
  3. Displaying User Information:

    • You can use the Office 365 Users connector to show relevant user data in your app:
      • For the Current User:
      • For Another User:
        • Add a text input control (e.g., a text box) and rename it (e.g., “InfoAbout”).
        • Enter an email address of a user in your organization (e.g., yourName@yourCompany.com).
        • Insert a label and set its Text property to any of the following formulas (using the email from the text input):
          • Office365Users.UserProfile(InfoAbout.Text).DisplayName
          • Office365Users.UserProfile(InfoAbout.Text).JobTitle
          • Office365Users.UserProfile(InfoAbout.Text).Mail
          • …and more.

Remember to adjust the control names and expressions based on your specific use case. The Office 365 Users connector provides powerful capabilities for working with user data, whether it’s your own profile or information about others in your organization! 🚀


How to get the Direct Reports (Sub Ordinates) of a user by Office365Users connector:

Get the direct reportees information into a collection by using the below function.


Add Office365Users connector.

ClearCollect(
    myTeam,
    Office365Users.DirectReports(
        Office365Users.UserProfileV2(User().Email).id
    )
)

How to get User ID or User Principal name for a user by Office365Users connector:

Add Office365Users connector.
Use UserProfileV2 function to get the user id or principal name by passing the user email id as shown below:

 Office365Users.UserProfileV2(User().Email).id

How to add a blank record to a collection? 


ClearCollect(
    myTeam,
    Ungroup(
        Table(
            {},
            {
                Value: 
                Office365Users.DirectReports(
                    Office365Users.UserProfileV2(User().Email).id
                )
            }
        ),
        "Value"
    )
)

No comments

Powered by Blogger.