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
How to connect power bi to microsoft teams, extracting information from app shifts that its use from create timetable.
Solved! Go to Solution.
Hello sjb9:
In my application I ussed an OData feed to directly query the Graph (beta) API directly into PowerBi. The data is then updated when the report is refreshed. Have not yet worked with "Flow". The user is currently refreshing the reports as needed as a short term solution. Hope this helps.
= OData.Feed("https://graph.microsoft.com/beta/teams/your teams ID #/schedule", null, [Implementation="2.0"])
Anyone managed to get data from TimeCards in shifts? (clocking in and out times).
I have just tried:
https://graph.microsoft.com/beta/teams/#your teams ID #/schedule/timeCards
and got Expression.Error: Access to the resource is forbidden.
Hi @jmoreyproadata ,
Does that make sense? If so, kindly mark my answer as the solution to close the case please. More people will benefit from here. Thanks in advance.
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Kudos are nice too.
Hi @jmoreyproadata ,
Currently, we can't get data from Teams directly in Power BI. We only can check usage data from Teams and view report in Teams . To make Power BI better, you can submit your request at Power BI Ideas and vote it up.
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Is it possible to use the Graph API to import the shift data from TEAMS to Power BI to use as a data slicer/ filter?? This is a very typical application for manufacturing. Much needed. Is it possible? Is that the BETA of Graph has this functionality. Is there a better way
https://docs.microsoft.com/en-us/graph/api/schedule-list-shifts?view=graph-rest-beta&tabs=http
Update to my own question for other users. This does work. Use an "ODATA" connection to the Graph API ( beta ). Only the beta API has the shifts data. You can then expand the lists that are returned from the API. We are actually using the shifts time data to cross filter other data in PowerBi via a calculated column in DAX.
Hi, I am able to access all other tables except time card. I get an 'access forbidden error'. Would you mind telling what permission levels did you set in your Azure to read the time card data?
@Anonymous Can you please explain a bit more about how you moved the data retrieved from the graph into PowerBI?
On Power Automate (Flow) I can only see the add to existing data set action for PowerBI.
Did you move the retrieved data somewhere else first, like a CSV file, or did it go straight into PowerBI.
Thanks
Hello sjb9:
In my application I ussed an OData feed to directly query the Graph (beta) API directly into PowerBi. The data is then updated when the report is refreshed. Have not yet worked with "Flow". The user is currently refreshing the reports as needed as a short term solution. Hope this helps.
= OData.Feed("https://graph.microsoft.com/beta/teams/your teams ID #/schedule", null, [Implementation="2.0"])
Hi @Anonymous ,
Thanks for sharing the solution!
$clientId = "XXXXXXXXXXXXXXXXXXXX"
$clientSecret = "XXXXXXXXXXXXXXXXXXXX"
$tenantName = "XXXXXXXXXXXXXXXXXXXX"
$resource = "https://graph.microsoft.com/"
$tokenBody = @{
Grant_Type = "client_credentials"
Scope = "https://graph.microsoft.com/.default"
Client_Id = $clientId
Client_Secret = $clientSecret
}
$tokenResponse = Invoke-RestMethod -Uri "https://login.microsoftonline.com/$TenantName/oauth2/v2.0/token" -Method POST -Body $tokenBody
#__________________________________#__________________________________#__________________________________#_______________________________
$URL = "https://graph.microsoft.com/beta/teams/XXXXXXXXXXXXXXXXXXXX/schedule"
$result = Invoke-RestMethod -Headers @{Authorization = "Bearer $($tokenResponse.access_token)"} -Uri $URL -Method Get -ContentType "application/json"
I use PowerShell
I have a mistake
Invoke-RestMethod : {
"error": {
"code": "Forbidden",
"message": "{\"error\":{\"code\":\"Forbidden\",\"message\":\"MS-APP-ACTS-AS header needs to be set for application context requests.\",\"details\":[],\"innererror\":{\"code\":\"MissingUserIdHeaderInAppContext\"}}}",
"innerError": {
"date": "2020-06-28T17:07:59",
How can I fix this error?
MS-APP-ACTS-AS
Did You manage to solve the problem?
just add parametr "user_id" in headers
user_id who makes the requers (probably)
power query
getDataApi = Json.Document(Web.Contents("https://graph.microsoft.com/v1.0/",
[RelativePath = "teams/"&group_id &"/schedule/shifts", Headers = [Authorization = "Bearer "&token, #"MS-APP-ACTS-AS" = user_id], ManualStatusHandling={400}]))
C
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 |
---|---|
93 | |
85 | |
84 | |
73 | |
49 |
User | Count |
---|---|
142 | |
133 | |
110 | |
68 | |
55 |