Introduction
In the previous article, "Get User Properties with 'Get user profile' action in Power Automate", we discussed the approach to retrieving user profiles in Microsoft Power Automate using the default action "Get user profile (v2)." Now, we will learn how to retrieve specific details of a user's profile information using Graph API by filtering with the user's UPN or other properties. In this process, we need to call an HTTP request via Graph API from inside Power Automate using the "Send an HTTP request" action, which requests a specific endpoint.
This action lets us retrieve user profile information in a JSON object for the specified user. By adding the connector to our flow, configuring it with the necessary details such as the endpoint URL, HTTP method, request headers, and body, and using dynamic content to pass in any required parameters or values, we can easily integrate external systems or services with our Power Automate flow and automate our business processes.
You can easily retrieve the complete user profile with the previous action if you have the user's email or UPN. However, if you don't have this information, you can still search for the user using their job title or a unique user code within your organization with the help of a Graph API request. This process can be seamless and efficient, allowing you to easily find and access the user's profile information quickly and easily.
Here are the steps to get user properties using the Graph API.
How do we Create a New Flow?
- To start with, go to this link.
- Sign in to the Power Automate portal with the appropriate authentication credentials to start building your flow. Once signed in, select the environment where you want to create the flow. If you haven't created an environment yet, refer to this article for instructions on how to do so.
- Now click on "My flows" in the left navigation menu. This will open a window displaying all your existing flows with detailed information about each.
- Next, select the "New flow" dropdown menu, which will display a list of all the possible flows you can create. For this demonstration, let's select "Instant cloud flow".

Figure 1- Power Automate window for a new flow
- A new window will open with a few actions to take, as shown in Figure 2. In position 1, you must provide a name for the flow. For this example, here we have used "GetUserProfileDetails".
- Now to choose the trigger of this flow from position 2, you can select according to your requirements. For instance, in this example, "Manually trigger a flow" has been selected for easier testing,
- Once you have provided the name and selected the trigger option, click the "Create" button, as shown in position 3, to create the flow.

Figure 2- Creating Instant cloud flow
With Graph API
- User details can also be retrieved with the Graph API using an HTTP Get request. The URI would be,
<span style="font-size:12.0pt"><span style="font-family:Consolas">https://graph.microsoft.com/v1.0/users?$filter=<property> eq '<value>'</span></span>The endpoint to call a user is "https://graph.microsoft.com/v1.0/users". However, such a request would give you all the users, which may not be what you want. To retrieve specific users based on a condition, you can use the filter option to filter by User Principal Name or other properties. As shown in the URI above, the property name can be used as "mail", and the value would be the user's email or UPN.
- To call this Graph API from Power Automate, we need an action that sends an HTTP request. In Power Automate, we can find several "Send an HTTP request" actions, but we need to use the "Send an HTTP request" action from "Office 365 Groups," as shown in Figure 3.
- Figure 3 shows another "Send an HTTP request" action from "Office 365 Users," which we should not use for this URI. The reason is that using this action will result in an error, as shown below:

Figure 3- Selecting Send an HTTP request action
- Now, select 'Send an HTTP request' from Office 365 Groups, as shown in Figure 3; we can add it as a new step in Power Automate, just like in Figure 4.
- In the URI field, enter the Graph API URI with the mail filter, and select the method as 'Get' and the Content-Type as 'application/json'. Other filter conditions, such as JobTitle eq 'Manager', can be used as required, which may retrieve multiple entries.
- To retrieve specific property of the user, “$select” statement can be used like this way:https://graph.microsoft.com/v1.0/users?$select=displayName, birthday&$filter=JobTitle eq 'Manager'



Sahriar SharifPosted May 25, 2023, 7:51 AM
Nice article......... :)