I need to be able to get the events in both directions ASC/DESC using Microsoft Graph API. I'm trying the following API to achieve that:
https://graph.microsoft.com/v1.0/me/events?$orderby=start
However, when I perform the request I get the following error:
{
"error": {
"code": "BadRequest",
"message": "The $orderby expression must evaluate to a single value of primitive type.",
"innerError": {
"request-id": "c00d676d-ef8e-418b-8561-80e08729da71",
"date": "2017-11-16T13:31:59"
}
}
}
Also, I tried to access the date directly:
https://graph.microsoft.com/v1.0/me/events?$orderby=start.dateTime
Got the following error:
{
"error": {
"code": "BadRequest",
"message": "The child type 'start.dateTime' in a cast was not an entity type. Casts can only be performed on entity types.",
"innerError": {
"request-id": "240342f5-d7f6-430b-9bd0-190dc3e1f73b",
"date": "2017-11-16T13:32:39"
}
}
}
Is there a way to sort events by date in ASC/DESC order?
You're very close but you're referencing DateTime
incorrectly. The proper format is {parent}/{child}
. These will work:
https://graph.microsoft.com/v1.0/me/events?$orderby=start/dateTime
https://graph.microsoft.com/v1.0/me/events?$orderby=start/dateTime desc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With