title: Microsoft Exchange REST API write calendar event with POST from Powershell
body: <p>I tried to access the calendars of my Exchange 2016 CU5 environment via REST-API using Powershell. GET methods are working fine with no errors, but now I tried to write a calendar event with POST method and it won't work. Here's my code:</p>
  
  <pre><code>$cred = Get-Credential
  
  $url = "https://myexchangeserver.de/api/v2.0/me/events"
  
  $content = "application/json"
  
  $body = "{
    ""Event"": {
    ""Subject"": ""Testtermin REST"",
    ""Body"": {
      ""ContentType"": ""HTML"",
      ""Content"":""Testtermin REST""
    },
    ""Start"": {
    ""DateTime"": ""2017-10-10T16:00:00"",
    ""TimeZone"": ""Europe/Berlin""
    },
    ""End"": {
    ""DateTime"": ""2017-10-10T16:30:00"",
    ""TimeZone"": ""Europe/Berlin""
    },
    ""Attendees"": [
  {
    ""EmailAddress"": {
      ""Address"": ""otto.outlooktest@hft-stuttgart.de"",
      ""Name"": ""Otto Outlooktest""
    },
    ""Type"": ""Required""
  }
    ]
  }}"
  
  Invoke-RestMethod -Uri $url -Method Post -Credential $cred -ContentType $content -Body $body
  </code></pre>
  
  <p>I put this into a .ps1 file and execute it within my Exchange Management Shell.</p>
  
  <p>It opens a popup-windows to let me enter my credentials, but afterwards I always get a error message "400 invalid request".</p>
  
  <p>I already tried several writings, but always the same.</p>
  
  <p>Anyone got a idea what's wrong?</p>
  
  <p>Greetings, Michael</p>