Sending Microsoft Graph request events returns 400

2019-05-27 05:07发布

问题:

I was able to create an event with Graph by posting the JSON request to https://graph.microsoft.com/v1.0/me/calendar/events. I had not looked at it for a while, but now I get a 400 (bad request) when I do so. For a scope I have specified "openid offline_access User.Read Calendars.ReadWrite Contacts.Read Mail.Send" (I am doing more than just creating a calendar event). I am authenticated, and can successfully create an email when posting to https://graph.microsoft.com/v1.0/me/sendmail. I have tried changing the url to https://graph.microsoft.com/v1.0/me/events to create the event, but still get the 400. The request I am sending basically looks like this:

{
 "@odata.etag":null,"attendees":
 [
  {
   "emailAddress":
   {  
    "address":"reafirstname.reallastname@realdomain.com",
    "name":"reafirstname reallastname"
   },
   "status":null,
   "type":"Required"
  }
 ],
"body":
{
 "content":"simplified test",
 "contentType":"Text"
},
"bodyPreview":null,
"categories":null,
"changeKey":null,
"createdDateTime":null,
"end":
{
 "dateTime":"2017-03-12T17:30:00.0000000",
 "timeZone":"UTC"
},
"hasAttachments":false,
"iCalUId":null,
"id":null,
"importance":null,
"isAllDay":false,
"isCancelled":false,
"isOrganizer":false,
"isReminderOn":false,
"lastModifiedDateTime":null,
"location":null,
"onlineMeetingUrl":null,
"organizer":
{
 "emailAddress":
 {
  "address":"reafirstname.reallastname@realdomain.com",
  "name":"reafirstname reallastname" 
 }
},
"originalEndTimeZone":null,
"originalStart":null,
"originalStartTimeZone":null,
"recurrence":null,
"reminderMinutesBeforeStart":0,
"responseRequested":false,
"responseStatus":null,
"sensitivity":null,
"seriesMasterId":null,
"showAs":null,
"start":
{
 "dateTime":"2017-03-12T17:00:00.0000000",
 "timeZone":"UTC"
},
"subject":"Test Event created from API",
"type":"singleInstance",
"webLink":null
}

I can only guess that I am missing some required parameter now that wasn't before. Any ideas why this would return a 400?