Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
I have a SharePoint list with a person field. And I would like to get the supervisor of this person field in Power BI.
How can I do it? I cannot find Office 365 in "Get Data".
Solved! Go to Solution.
To get the supervisor of a person field from a SharePoint list in Power BI, you can use the Microsoft Graph API to fetch the user's manager information from Office 365. Here's how you can achieve this:
Get Data from SharePoint Online List:
Fetch Supervisor Data using Microsoft Graph API:
Register an Application in Azure AD:
Grant API Permissions:
Fetch Data in Power BI Using Power Query:
let
clientId = "your_client_id",
clientSecret = "your_client_secret",
tenantId = "your_tenant_id",
resource = "https://graph.microsoft.com/",
authority = "https://login.microsoftonline.com/" & tenantId & "/oauth2/v2.0/token",
body = "client_id=" & clientId & "&scope=" & Uri.EscapeDataString(resource & ".default") & "&client_secret=" & Uri.EscapeDataString(clientSecret) & "&grant_type=client_credentials",
authResponse = Json.Document(Web.Contents(authority, [Content=Text.ToBinary(body), Headers=[#"Content-Type"="application/x-www-form-urlencoded"]])),
accessToken = authResponse[access_token],
// Replace 'userPrincipalName' with the actual user field you are querying
userPrincipalName = "user@example.com",
managerUrl = "https://graph.microsoft.com/v1.0/users/" & userPrincipalName & "/manager",
managerResponse = Json.Document(Web.Contents(managerUrl, [Headers=[Authorization="Bearer " & accessToken]])),
managerName = managerResponse[displayName]
in
managerName
This approach will allow you to get the supervisor information of a person field from a SharePoint list in Power BI.
If you prefer using Power Automate to fetch and store the supervisor information, you can create a flow to get the manager of a user and store it in the SharePoint list:
Create a Flow in Power Automate:
Use the Updated SharePoint List in Power BI:
By using either of these methods, you can effectively retrieve and display supervisor information in Power BI
@AdrianChang , do you have supervisor information in Office 365, usually it should be there in your ERP
of if you have configured it in Exchange : https://learn.microsoft.com/en-us/exchange/address-books/hierarchical-address-books/hierarchical-add...
Also, check if you can connect to the exchange using the active directory connector
https://community.fabric.microsoft.com/t5/Desktop/Email-Address-Book/td-p/2401882
There are a slew of profile fields available in the SharePoint Online list connector, primarily the 1.0 version, but I don't think manager is one of them. You can expand things like job title, department, email, name, and other things there though with the expandy arrow next to the field (it'll be one of the ones on the far right that has a different icon than the text fields).
There are a slew of profile fields available in the SharePoint Online list connector, primarily the 1.0 version, but I don't think manager is one of them. You can expand things like job title, department, email, name, and other things there though with the expandy arrow next to the field (it'll be one of the ones on the far right that has a different icon than the text fields).
@AdrianChang , do you have supervisor information in Office 365, usually it should be there in your ERP
of if you have configured it in Exchange : https://learn.microsoft.com/en-us/exchange/address-books/hierarchical-address-books/hierarchical-add...
Also, check if you can connect to the exchange using the active directory connector
https://community.fabric.microsoft.com/t5/Desktop/Email-Address-Book/td-p/2401882
To get the supervisor of a person field from a SharePoint list in Power BI, you can use the Microsoft Graph API to fetch the user's manager information from Office 365. Here's how you can achieve this:
Get Data from SharePoint Online List:
Fetch Supervisor Data using Microsoft Graph API:
Register an Application in Azure AD:
Grant API Permissions:
Fetch Data in Power BI Using Power Query:
let
clientId = "your_client_id",
clientSecret = "your_client_secret",
tenantId = "your_tenant_id",
resource = "https://graph.microsoft.com/",
authority = "https://login.microsoftonline.com/" & tenantId & "/oauth2/v2.0/token",
body = "client_id=" & clientId & "&scope=" & Uri.EscapeDataString(resource & ".default") & "&client_secret=" & Uri.EscapeDataString(clientSecret) & "&grant_type=client_credentials",
authResponse = Json.Document(Web.Contents(authority, [Content=Text.ToBinary(body), Headers=[#"Content-Type"="application/x-www-form-urlencoded"]])),
accessToken = authResponse[access_token],
// Replace 'userPrincipalName' with the actual user field you are querying
userPrincipalName = "user@example.com",
managerUrl = "https://graph.microsoft.com/v1.0/users/" & userPrincipalName & "/manager",
managerResponse = Json.Document(Web.Contents(managerUrl, [Headers=[Authorization="Bearer " & accessToken]])),
managerName = managerResponse[displayName]
in
managerName
This approach will allow you to get the supervisor information of a person field from a SharePoint list in Power BI.
If you prefer using Power Automate to fetch and store the supervisor information, you can create a flow to get the manager of a user and store it in the SharePoint list:
Create a Flow in Power Automate:
Use the Updated SharePoint List in Power BI:
By using either of these methods, you can effectively retrieve and display supervisor information in Power BI
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
87 | |
87 | |
84 | |
66 | |
49 |
User | Count |
---|---|
127 | |
109 | |
93 | |
70 | |
67 |