PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (2024)

PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (1)

PowerApps get current user – In this PowerApps tutorial, we will discuss how to get current user details in PowerApps. Let us see, how to display SharePoint online site logged in user details like username, user id, and email address and display in a PowerApps screen or form.

Also, we will see these things as:

  • What is User function in Power Apps
  • How to get the current user in PowerApps
  • Get current user email Address in PowerApps
  • Get current user id in PowerApps
  • How to get PowerApps current user department
  • PowerApps get current user location
  • How to set current user Powerapps
  • PowerApps get current user profile
  • PowerApps current user photo or PowerApps current user image

Table of Contents

User function in PowerApps

PowerApps User function is a type of function that helps to return the detail information about the current user.

Always this PowerApps User function returns the record details of the current logged in user. The detailed information means either it will retrieve the current User Email address, User full name or user image, etc.

NOTE:

PowerApps User function will match the Account information that is displayed in the PowerApps players and studio that can be found outside of any authored apps. This may not match the current user’s information in Office 365 or other services.

PowerApps User function Syntax

The syntax of PowerApps User function is:

User()

Below table represents some PowerApps user function properties with their descriptions as:

PropertyDescriptionOutput
User()This function returns all the information about the current user (in PowerApps).{ FullName: “Monika Singh”, Email: “monika123@tsinfo.com”, Image: “blob:1234…5678” }
User().EmailThis Powerapps function returns the email address of the current user (in PowerApps)“monika123@tsinfo.com”
User().FullNameThis Powerapps function helps to return the full name of the current user including the first and last name.“Monika Singh”
User().ImageThis function returns the image URL of the current user. But the image URL will appear with the form like “blob:identifier“. You can set the Image property of the Image control to this value to display the image in the app.“blob:5678…1234”

Check out more on PowerApps Image control.

PowerApps get current user

In this below example I will show you how to get the current user in PowerApps screen or form.

  • Sign in the PowerAppsapp with your credentials.
  • Create a blank new Canvas app and choose any one Layout either Tablet or Phone.
  • On the PowerApps Blank screen, take these below input controls as:
  1. Insert one Label control (Insert -> Label) and rename it to lblUserName.
  2. Add one Text input control (Insert -> Input -> Text input) and rename it to txtUserName.
  3. Select the text input control (txtUserName) and set its Default property as:
Default = User().FullName

Save and Preview (F5) the app. Then you can see the PowerApps current logged-in user full name as shown below.

PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (2)

PowerApps get current user email

  • Similarly, you can retrieve the current user email address of the logged-in user (in PowerApps).
  • In the same way, On the PowerApps screen, insert a Label for UserEmail and a Text input control to display the value.
  • Select the text input control and set its Default property as:
Default = User().Email

Save and Preview (F5) the app. Then you can see the PowerApps current logged-in user Email Address as shown below.

PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (3)

PowerApps get current user id

To get the current logged in user id in PowerApps, we need to do these below things as:

  • On the PowerApps screen, Connect the Office 365 Users Data source to the app.
  • Go to View tab -> Data sources -> Search Office 365 Users -> Add a new or existing connection as shown below.
PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (4)
  • Insert a Text input control to display the User ID. Select the text input control and apply this below formula on its Default property as:
Default = Office365Users.UserProfile(User().Email).Id

Once you will save and preview (F5) the app, then you can see the PowerApps the currently logged-in user Id as shown below.

PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (5)

PowerApps get current user department

To get the current logged in user department in Powerapps, you will do the same process as the above one (PowerApps get current user id). Just we need to update the Department value instead of the ID value.

  • In the same way, you will add the Office 365 Users Data source connector to the app.
  • Insert a Text input control and set its Default property as:
Default = Office365Users.UserProfile(User().Email).Department

When you will save and preview (F5) the app, then you can see the PowerApps current logged-in user Department like the below screenshot.

PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (6)

PowerApps get current user location

Similarly, You can easily get the current user location in PowerApps.

  • Add the Office 365 Users Data source connector to the app.
  • Add a Text input control that will display the user office location.
  • Select the text input control and apply this below formula on its Default property as:
Default = Office365Users.UserProfile(User().Email).OfficeLocation

Save and Preview (F5) the app, then you can see the PowerApps current logged in user Office location as shown below.

PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (7)

Set current user Powerapps

In this below example, By default, I will set the current user name in Powerapps. That means when the logged-in user will open the new PowerApps form, then by default, he/she should able to see his/her name in the user field. Let’s have a look at how we can do these things.

  • I have a SharePoint Online List named Default User Selection. This list has these below columns as:
  1. Title: By default, this is a single line of text data type column present in the list.
  2. User Name: This is a Person Data type column that I have created.
  3. Creator Name: This is a Single Line of text data type column.
PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (8)

On the Powerapps screen, do these below things as:

  • Add Office 365 Users data source connector to the app.
  • Connect the SharePoint Data source and add the SharePoint Online list (Default User Selection). Go to View tab -> Data Sources -> Search SharePoint -> Add a new or existing connection -> Select the SharePoint Site -> Choose the specific SharePoint List (Default User Selection) -> Hit on the Connect button. Then the specific SharePoint list will be added as shown below.
PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (9)
  • Insert one PowerApps Edit form (Insert -> Forms -> Edit) and Insert the SharePoint list data source to it.
  • Then you can see the edit form will appear with these below fields. Just unlock all the Data card values from the edit form.
PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (10)
  • Next, Select the People picker field (User Name) and apply this below formula on its Default property as:
Default = { '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", DisplayName: User().FullName, Claims: "i:0#.f|membership|" & Lower(User().Email), Department: "", Email: User().Email}

Refer the below screenshot.

PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (11)
  • Similarly, add the same formula on fields (User Name) DefaultSelectItems property as the below screenshot.
PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (12)
  • Now, you can see the PowerApps current logged-in user name will appear in the User Name field. When the user will open this edit form, then by default, he or she can able to view his/her name in the User Name field.
PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (13)
  • Similarly, if you want to set the full name of the Creator, then select the Creator Name field and set its Default property as:
Default = User().FullName
PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (14)
  • Just save and preview the app, By default, You can see the current logged in user name in the User Name field and as well as in the Creator Name field.

PowerApps get current user profile

In this scenario, We will see how we can get current user profile in PowerApps. This is also known as PowerApps Auto Fill User Profile Details.

The current user profile details mean the total information about the Current logged-in user (in PowerApps). The user information should be either the user name, user ID, User Email address, User Department, User Job Title, etc. All these user information things we should get in one PowerApps form. Follow these below steps to do so:

  • I have created a SharePoint Online list named Employee User Profile. This list has these below columns as:
  1. Title: By default, it is a single line of text Data type
  2. Employee Name: Person or Group Data type
  3. Employee ID: Single line of text Data type
  4. Employee Email: Single line of text Data type
  5. Department: Single line of text Data type
  6. Job Title: Single line of text Data type
PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (15)
  • Go to the PowerApps Canvas app.
  • Connect the Office 365 Users Data source connector to the app.
  • Connect the SharePoint Data source and add the SharePoint Online list (Employee User Profile).
PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (16)
  • Insert one PowerApps Edit form and add the SharePoint list Data source on to it. Then the form will appear with these below fields as shown below.
  • Next, Unlock all the Data card field values.
PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (17)
  • Now its time to set the user information details to each field. Let’s see how to apply the formulas to each control in the edit form.
  1. Title: Here, you need to enter the values before submitting the form.
  2. Employee Name: To get the user name, just repeat the same steps from the above example (Set current user Powerapps)
  3. Employee ID: To get the current employee ID, Select the Employee ID field, and apply this below formula on its Default property as:
Default = If(Form1.Mode = FormMode.New, Office365Users.UserProfile(User().Email).Id ,Parent.Default)

4. Employee Email: To get the current employee Email Address, Select the Employee Email field, and apply this below formula on its Default property as:

Default = If(Form1.Mode = FormMode.New, Office365Users.UserProfile(User().Email).Mail ,Parent.Default)

5. Department: To get the current employee Department, Select the Department field, and apply this below formula on its Default property as:

Default = If(Form1.Mode = FormMode.New, Office365Users.UserProfile(User().Email).Department ,Parent.Default)

6. Job Title: To get the current employee Job Title, Select the Job Title field, and apply this below formula on its Default property as:

Default = If(Form1.Mode = FormMode.New, Office365Users.UserProfile(User().Email).JobTitle ,Parent.Default)
  • All these above values should be fetched from the connector only when the form is opened in New mode. Otherwise, it will display the saved value from the database.

Below screenshot represents for your reference.

PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (18)

NOTE:

Not only the Office 365 Users connector have this much user information, but also it has many user profile details like City, Company Name, Country, Mobile Phone, Postal Code, Telephone Number, Surname, Business Phones, etc.
  • Save and Preview the app. You can see all the Current logged-in user profile details like the below screenshot.
PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (19)

PowerApps current user photo or PowerApps current user image

Suppose you want to display the PowerApps Current Logged in Users photo in the PowerApps screen, then follow these below steps:

  • On the PowerApps screen, insert a Text input control and set its Default property to User().Image.
  • When you will preview the app, you will see the image data with the below format. Because when you will add the text input, it will retrieve the image text data, not the image.
PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (20)
  • To get the current user profile photo, we need to add an Image control on the Powerapps screen. So that we can easily view the image of Powerapps current logged in user.
  • Insert an Image control (Insert -> Media -> Image). Select the image control and apply this below formula on its Image property as:
Image = User().Image
PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (21)
  • Also, you can apply this below formula to Image property to get the current user profile picture as:
Image = Office365Users.UserPhoto(Office365Users.MyProfile().Id)
PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (22)
  • Once you will save and preview the app, you can able to see the Powerapps current logged-in user profile picture as the above screenshot.

Also, you may like these below PowerApps Tutorials:

  • PowerApps Patch Function with examples
  • PowerApps send email on submit
  • PowerApps Email Attachment Control – How to Use
  • PowerApps Microphone Control – How to use
  • PowerApps Popup message Box with Examples
  • Get users from SharePoint Group in PowerApps
  • PowerApps role based security SharePoint example (SharePoint Groups)
  • PowerApps: Submit data to two SharePoint Lists
  • Show hide fields based on dropdown selection PowerApps
  • Build PowerApps Quiz App – Step by Step
  • How to build multilingual app in PowerApps

In this PowerApps Tutorial, We discussed how to get and display the current user details in the PowerApps screen or form. Also, we saw these things as:

  • What is User function in Power Apps
  • How to get the current user in PowerApps
  • Get current user email Address in PowerApps
  • Get current user id in PowerApps
  • How to get PowerApps current user department
  • PowerApps get current user location
  • How to set current user Powerapps
  • PowerApps get current user profile
  • PowerApps current user photo or PowerApps current user image

PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (23)

Bijay Kumar

I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com

PowerApps Get Current User (ID, EMail, Department, Location, Photo, etc) - SPGuides (2024)

FAQs

How do I get user ID from email in power automate? ›

Step 1: Create a Flow in Power Automate

Click on “Create” and select “Automated cloud flow”. Choose the trigger “When a new email arrives” and connect to the desired email account. Add the “Get user profile” action and select the email address as the input. Configure the action to retrieve the user profile information.

How do I find the location of a user in Powerapps? ›

Click on the “Insert” tab in the Power Apps Studio and select “Controls”. Search for “Location” in the controls search bar and drag the Location control onto your screen. With the location control selected, navigate to the “Advanced” section in the properties pane.

What is user () in Powerapps? ›

Examples
FormulaDescription
User()Record of all information for the current Power Apps user.
User().EmailThe email address of the current Power Apps user.
User().FullNameThe full name of the current Power Apps user.
User().EntraObjectIdMicrosoft Entra Object ID of the current user.
1 more row
Mar 22, 2024

How do I get to Power Platform admin center? ›

Accessing the Power Platform Admin Center

You can access the admin center at admin.powerplatform.microsoft.com. Log in with your Microsoft credentials. The homepage displays a dashboard with usage information.

How do I find the current location of a user? ›

Getting the current position

To obtain the user's current location, you can call the getCurrentPosition() method. This initiates an asynchronous request to detect the user's position, and queries the positioning hardware to get up-to-date information.

How do I fetch a user location? ›

Determining the user's current location

The Geolocation API offers a simple, "one-shot" method to obtain the user's location: getCurrentPosition() . A call to this method asynchronously reports on the user's current location.

How is the location of a user determined? ›

At a glance: User location is determined using the device IP address which is mapped to the general location of the user (city, state, country, and so on).

Can PowerApps be used by multiple users at the same time? ›

The apps made in PowerApps are multiuser. They each are their own instances so it does not matter how many users use it at the same time.

How do I change the default value to the current user in PowerApps? ›

To set the default value of a User field, select the People Picker card in PowerApps and, paste the following code in the Default property. Form. Mode = New: A condition is checked to apply the default setting for new forms only. This will allow users to change the default selection, if they want.

How do I check my PowerApps log? ›

You can review your audit data in the Microsoft Purview compliance portal. See Search the audit log in the compliance Center. To use the preconfigured Power Apps reports, go to https://protection.office.com > Search & investigation > Audit log search and select the Power Apps app activities tab.

What is a user ID for my email? ›

Your user ID is the unique email address that was created for you to use when you sign in to Microsoft 365. A user ID may look similar to the following: ellen@contoso.partner.onmschina.cn.

What is the email user ID macro? ›

The Email Unique Identifier macro is a piece of code provided by your email platform. It generates an ID - the aforementioned Email Unique Identifier (EUID) - for every email that gets sent out.

Is the user ID the email ID? ›

A user ID is a unique identifier, commonly used to log on to a website, app, or online service. It may be a username, account number, or email address. Many websites require an email address for the user ID.

Where do we find the email ID of a user in Active Directory? ›

Search for an Email Address in Active Directory

Run the “All users” report and make sure you have the mail and proxyAddresses attribute added.

Top Articles
Latest Posts
Article information

Author: Nathanael Baumbach

Last Updated:

Views: 6403

Rating: 4.4 / 5 (75 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Nathanael Baumbach

Birthday: 1998-12-02

Address: Apt. 829 751 Glover View, West Orlando, IN 22436

Phone: +901025288581

Job: Internal IT Coordinator

Hobby: Gunsmithing, Motor sports, Flying, Skiing, Hooping, Lego building, Ice skating

Introduction: My name is Nathanael Baumbach, I am a fantastic, nice, victorious, brave, healthy, cute, glorious person who loves writing and wants to share my knowledge and understanding with you.