Forum Discussion
Use Microsoft Graph API as data source
- 7 years ago
The Microsoft Graph implements the OAuth 2.0 authentication flow and therefore, to access it with Power BI, you'll need to create a custom data connector. Here's a tutorial that walks step-by-step on how to create a custom data connector with OAuth 2.0 to the Microsoft Graph in Power BI.
Not sure I can ask this here, as it belongs a little to this question, but how can I use POST with this solution? Like the https://graph.microsoft.com/beta/me/calendar/getschedule query needs a header that I need to post to get the data?
I tried to find the answer in the documentation of OData.Feed. This says I can add the headers, but there's no syntax how to do this.
Unless query folding is an absolute must, I would use Web.Contents instead. OData.Feed is quite buggy.
I believe the inclusion of a body in your Http request header instructs Power BI to automatically make a POST request rather than a GET request.
Outside of any tool, what should the structure of your request look like?
- vilmarci7 years agoFrequent Visitor
Thanks, it is working :)
I added the parameters in an extra file like:
{
"schedules": [
"[email protected]",
"[email protected]"
],
"startTime": {
"dateTime": "2019-03-01T09:00:00",
"timeZone": "Central European Time"
},
"endTime": {
"dateTime": "2019-04-01T09:00:00",
"timeZone": "Central European Time"
},
"availabilityViewInterval": "15"
}And indeed, if I add this like:
source = Json.Document(Web.Contents(url,[ Headers = [#"Content-Type"="application/json"], Content = Text.ToBinary(params) ] ))
I get the data I want :)
- Anonymous7 years agoNot applicable
Hi, Did the solution worked for you? I have tried to develop the solution in visual studio but I am having troubles, I don't have any experience in M, Would you mind sharing me your project in order to take a look?
Thanks
- Anonymous7 years agoNot applicableHi- How did you do this please ? could you please share a pbit or generic example? Ive been stuck for months - many thanks - Jude Moore