Odata v.4 $ filter用于Office 365 REST API中的DateTime日历事件 [英] Odata v.4 $filter for the DateTime Calendar Events in the Office 365 REST API

查看:166
本文介绍了Odata v.4 $ filter用于Office 365 REST API中的DateTime日历事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下查询从Office 365 REST API获取和过滤日历事件:

https://outlook.office.com/api/v2.0/users/user@user.com/calendars/AAAAAAAAAAA/events?$top=100&$select=BodyPreview&$filter=Start ge 2016-02-10T22:00:00Z

因此,我希望100条结果仅将BodyPreview作为大于2016-02-10 22:00:00的所有事件的返回值.

我收到的错误消息是这样的:

ERROR request returned 400
error:
code: 'RequestBroker-ParseUri',
message: 'A binary operator with incompatible types was detected. Found operand types \'Microsoft.OutlookServices.DateTimeTimeZone\' and \'Edm.DateTimeOffset\' for operator kind \'GreaterThanOrEqual\'.'

没有过滤器选项的查询可以正常工作.那么如何获取代表"Microsoft.OutlookServices.DateTimeTimeZone"类型的查询?

我看了一下这篇文章: Odata $ filter用于Office 365中的日期REST API

但是我看不到我的查询与帖子中的查询之间的区别.

以及 https://msdn.microsoft.com/zh-cn/office/office365/api/complex-types-for-mail-contacts-calendar 在示例中没有提及这种类型的DateTimeTimeZone查询.

我也尝试过以下查询格式:

datetime'2016-01-10T22:00:00'

也没有运气. 有什么想法吗?

解决方案

StartEnd的类型Odata $filter for the date in the Office 365 REST API

But I can not see the difference between my query and the one in the post.

And all examples on https://msdn.microsoft.com/en-us/office/office365/api/complex-types-for-mail-contacts-calendar do not mention this type of DateTimeTimeZone query in the examples.

I also tried this query format:

datetime'2016-01-10T22:00:00'

Also no luck. Any ideas?

解决方案

The type for Start and End changed in the beta and v2 endpoints. It's now a complex type, so you need to change your filter a bit:

$filter=Start/DateTime ge 2016-02-10T22:00:00Z

这篇关于Odata v.4 $ filter用于Office 365 REST API中的DateTime日历事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆