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?

Get User Properties with Graph API in Power Automate
Figure 1- Power Automate window for a new flow

Get User Properties with Graph API in Power Automate
Figure 2- Creating Instant cloud flow

With Graph API

"URI path is not a valid Graph endpoint, the path is neither absolute nor relative, or resource/object is not supported for this connector."

Get User Properties with Graph API in Power Automate
Figure 3- Selecting Send an HTTP request action

Get User Properties with Graph API in Power Automate
Figure 4- Details of Send an HTTP Request

Response of the HTTP Request
Figure 5- Response of the HTTP Request

User Profile Properties

Below are some user properties that can be retrieved using the 'Get user profile' action, along with their respective types and details. These properties can be added as dynamic content to the subsequent steps in the flow.

Property Type Description
Display Name String To create a user, it is mandatory to provide the name, usually a combination of the first name, middle initial, and last name. This property cannot be cleared during updates, and its maximum length is restricted to 256 characters.
Given Name String This property represents the user's first name, and its length cannot exceed 64 characters.
Surname String This property represents the user's last name, with a maximum length of 64 characters.
Nickname String The mail alias for the user. This property must be specified when a user is created. Maximum length is 64 characters.
Birthday DateTimeOffset The date of birth of the user.
Business Phones String collection This property is a collection of strings that holds the user's phone numbers, but it only allows setting one number.
Hire Date DateTimeOffset The user's hire date is always expressed in UTC.
User Type String This property classifies user types, such as "Member" and "Guest".
Mail String This property contains the SMTP address for the user, for example, [email protected].
User Principal Name String The principal user name (UPN) of the user. The UPN is an Internet-style login name for the user based on the Internet standard RFC 822. By convention, this should map to the user's email name. The general format is alias@domain, where the domain must be present in the tenant's verified domain collection. The verified domains for the tenant can be accessed from the verifiedDomains property of the organization. This property is required when a user is created.


Conclusion

In conclusion, obtaining a user profile within Power Automate is straightforward by using the "Get user profile" action. However, suppose you don't have the user's email or UPN and need to use alternative filters like job title, department, or a unique user code within your organization. In that case, you can utilize the 'Send an HTTP request" action from "Office 365 Groups.

Overall, there are several ways to retrieve user information within Power Automate, providing flexibility and options for different scenarios. You can extract the desired information using expressions or actions from the 'Data Operation' section. Simply provide the appropriate Graph API URI and filter condition, and this will return a JSON response containing all users that match the specified criteria.