Send From and To dates in graph.microsoft.com/beta/communications/callRecords/getPstnCalls as Query

Roman Korchak 16 Reputation points
2023-10-10T14:08:18.47+00:00

Hi All

I am looking for the way to change

OData.Feed("https://graph.microsoft.com/v1.0/communications/callRecords/getDirectRoutingCalls(fromDateTime="&DateTime.ToText(Date.AddDays(DateTime.LocalNow(),-1),"yyyy-MM-dd")&",toDateTime="&DateTime.ToText(DateTime.LocalNow(),"yyyy-MM-dd")&")", [ Authorization = "Bearer " & access_token ], [ ExcludedFromCacheKey = {"Authorization"}, ODataVersion = 4, Implementation = "2.0" ])


to something like

Web.Contents("https://graph.microsoft.com/v1.0/communications/callRecords/getDirectRoutingCalls",      [            Headers = [#"Content-Type"="application/json", #"Authorization"="Bearer " & access_token],            Query = [#"fromDateTime"=DateTime.ToText(Date.AddDays(DateTime.LocalNow(),-1),"yyyy-MM-dd"),                   #"toDateTime"=DateTime.ToText(DateTime.LocalNow(),"yyyy-MM-dd")]        ]   )

I am trying to use it in Power BI query and its required to avoid dynamic source issue
Thanks

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,447 questions
0 comments No comments
{count} votes