Reputation: 43
It appears as though there is some sort of limitation in the Office 365 REST API that prevents adding events with older dates, but I am unable to nail down the specific constraint. For example, the following JSON payload causes the request to fail with a 400 response:
{
"Subject":"Task/Other",
"Location":{},
"Body": {
"ContentType":"Text",
"Content":"Appointment text"
},
"Start": {
"DateTime":"1983-05-12T19:00:00",
"TimeZone":"America/New_York"
},
"End": {
"DateTime":"1983-05-12T19:30:00",
"TimeZone":"America/New_York"
}
}
However, the following payload succeeds:
{
"Subject":"Task/Other",
"Location":{},
"Body": {
"ContentType":"Text",
"Content":"Appointment text"
},
"Start": {
"DateTime":"2016-05-12T19:00:00",
"TimeZone":"America/New_York"
},
"End": {
"DateTime":"2016-05-12T19:30:00",
"TimeZone":"America/New_York"
}
}
The only difference is the more recent event date. I am unable to find anything in the API documentation about any such constraint. What am I missing?
Upvotes: 0
Views: 242
Reputation: 14649
I could reproduce this issue. However after I change the time zone to UTC, the issue was fixed. As a workaround, I suggest that you convent the time from "America/New_York" to "UTC" first and use the UTC time.
Here is the sample I tested for your reference:
POST: https://graph.microsoft.com/v1.0/me/events/
authorization: bearer {token}
Content-type: application/json
{
"Subject":"Task/Other",
"Location":{'DisplayName':'Water Cooler'},
"Body": {
"ContentType":"Text",
"Content":"Appointment text"
},
"Start": {
"DateTime":"1983-05-12T19:00:00",
"TimeZone":"UTC"
},
"End": {
"DateTime":"1983-05-12T19:30:00",
"TimeZone":"UTC"
}
}
And to fix this issue, you can try to contact the Office Developer team from here.
Upvotes: 0