Forum Discussion

Martin Strasser's avatar
Martin Strasser
Copper Contributor
May 15, 2018

Exchange Online REST API

Hello,

 

I want to use the REST-API from my Exchange Online account to edit the calendar entries.

When I try to connect with "invoke-webrequest" I get an error 403.

 

Where can I enable the API for my account in Exchange Online settings?

 

Regards,
Martin

  • REST is enabled by default. Are you providing an access token as part of the request? Do you have the necessary permissions to access the endpoint you are trying to (assuming you are using /user@domain.com/contacts)?

    • Martin Strasser's avatar
      Martin Strasser
      Copper Contributor

      Hello,

       

      I tried it with:

       

      iwr "https://outlook.office.com/api/v2.0/me/calendarview?startDateTime=2018-05-01T01:00:00&endDateTime=2018-10-31T23:00:00" -Credential $(Get-Credential)

       

      And the result is:

       

      iwr : The remote server returned an error: (403) Forbidden.
      At line:1 char:1
      + iwr "https://outlook.office.com/api/v2.0/me/calendarview?startDateTim ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
      eption
      + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

       

      Regards,

      Martin

Resources