title: How can I create a calendar event on Outlook with Microsoft Graph API?
body: <p>I have an app that integrates with Office365 and I am attempting to create a calendar event on an Outlook calendar using the Microsoft Graph API. Here is what I have so far:</p>
  
  <pre><code>        request.post({
              url:'https://graph.microsoft.com/v1.0/me/events',
              form: {
                  "Id": null,
                  "Subject": "Discuss the Calendar REST API",
                  "Body": {
                      "ContentType": "Text",
                      "Content": "This is some content."
                  },
                  "Start": {
                      "DateTime": "2016-01-24T18:00:00",
                      "TimeZone": "Pacific Standard Time"
                  },
                  "End": {
                      "DateTime": "2016-01-25T19:00:00",
                      "TimeZone": "Pacific Standard Time"
                  },
                  "ShowAs": "Free",
                  "IsReminderOn":false
              },
              headers: {
                  "Authorization": "Bearer " + access_token,
                  "Content-Type": "application/json"
              }
          }, function(err, httpResponse, body) {
              if (err) {
                  console.log('addMicrosoftAccessToken() ERROR = ' + err);
                  callback(err, false);
              } else {
                  console.log('httpResponse = ' + JSON.stringify(httpResponse));
                  callback(null, true);
              }
          })
  </code></pre>
  
  <p>The problem is that the event isn't saved on the users Outlook calendar. Also, I'm not getting an error in the log. I suspect that I'm not sending the proper form data in the request. Any ideas?</p>
  
  <p>UPDATE: Here is the <code>httpResponse</code> I'm getting in the log:</p>
  
  <pre><code>{
      "statusCode": 500,
      "body": "{\r\n  \"error\": {\r\n    \"code\": \"UnknownError\",\r\n    \"message\": \"\",\r\n    \"innerError\": {\r\n      \"request-id\": \"8ebe2efc-649c-4d8d-bee1-be2457cc3a45\",\r\n      \"date\": \"2016-01-25T19:05:27\"\r\n    }\r\n  }\r\n}",
      "headers": {
          "cache-control": "private",
          "transfer-encoding": "chunked",
          "content-type": "application/json",
          "server": "Microsoft-IIS/8.5",
          "request-id": "8ebe2efc-649c-4d8d-bee1-be2457cc3a45",
          "client-request-id": "8ebe2efc-649c-4d8d-bee1-be2457cc3a45",
          "x-ms-ags-diagnostic": "{\"ServerInfo\":{\"DataCenter\":\"East US\",\"Slice\":\"SliceB\",\"ScaleUnit\":\"000\",\"Host\":\"AGSFE_IN_4\",\"ADSiteName\":\"EST\"}}",
          "outboundduration": "707.5019",
          "duration": "713.2419",
          "x-powered-by": "ASP.NET",
          "date": "Mon, 25 Jan 2016 19:05:27 GMT",
          "connection": "close"
      },
      "request": {
          "uri": {
              "protocol": "https:",
              "slashes": true,
              "auth": null,
              "host": "graph.microsoft.com",
              "port": 443,
              "hostname": "graph.microsoft.com",
              "hash": null,
              "search": null,
              "query": null,
              "pathname": "/v1.0/me/events",
              "path": "/v1.0/me/events",
              "href": "https://graph.microsoft.com/v1.0/me/events"
          },
          "method": "POST",
          "headers": {
              "Authorization": "Bearer blah blah",
              "Content-Type": "application/x-www-form-urlencoded",
              "Accept": "application/json",
              "content-length": 643
          }
      }
  }
  </code></pre>
  
  <p>UPDATE 2:
  This link is titled "Create Event", and appears to have the response listed in both the request and response sections, making it particularly confusing:
  <a href="http://graph.microsoft.io/docs/api-reference/v1.0/api/event_post_instances" rel="nofollow">http://graph.microsoft.io/docs/api-reference/v1.0/api/event_post_instances</a>
  Also, in the above link where it lists</p>
  
  <pre><code>POST https://graph.microsoft.com/v1.0/me/events/&lt;id&gt;/instances
  </code></pre>
  
  <p>what is <code>&lt;id&gt;</code>? It doesn't tell me what id is supposed to be?</p>
  
  <p>UPDATE 3: This link is also titled "Create Event", yet it has a different POST URL:</p>
  
  <pre><code>http://graph.microsoft.io/docs/api-reference/v1.0/api/user_post_events
  </code></pre>
  
  <p>Very confusing. </p>