Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,447 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
HI Together
Can somone tell me why am i getting bad request using this query in powershell script.Authentication with token is working fine and some other query are working with same authentication method.
Same query is working in graph explorer.
ErrorMessage : Invoke-RestMethod : The remote server returned an error: (400) Bad Request.
Thanks in advance for your help.
$query = "https://graph.microsoft.com/v1.0/resourceMb@company.com/calendarView?startDateTime=2023-10-03T00:00:00&endDateTime=2023-10-04T00:00:00"
$appointments = (Invoke-RestMethod -Headers @{Authorization = "Bearer $($AccessToken)"} -Uri $query -Method Get).Value
I found the soulution. users in https query was missing.
"https://graph.microsoft.com/v1.0/users/resourceMb@company.com/calendarView?startDateTime=2023-10-03T00:00:00&endDateTime=2023-10-04T00:00:00"