如何在MS Graph中仅检索会议(多人预约)?求有效过滤方案
在MS Graph中筛选多人参与会议的可行方案
由于MS Graph不支持直接对attendees集合进行过滤(包括判断集合长度、使用lambda表达式筛选都会返回Invalid filter clause错误),可以通过以下字段实现需求:
isMeeting字段(推荐):这是MS Graph提供的布尔型字段,专门标记事件是否为会议。只要是包含其他参与者的会议(无论是否为在线会议),该字段值为true。示例请求:
https://graph.microsoft.com/v1.0/users/{{UserID}}/calendar/events?$filter=start/dateTime ge '{{start_datetime}}' and end/dateTime le '{{end_datetime}}' and isMeeting eq true
- 结合
type字段精准筛选:事件的type字段包含枚举值,其中meeting类型对应多人会议场景。可以和isMeeting配合使用,进一步缩小范围:
https://graph.microsoft.com/v1.0/users/{{UserID}}/calendar/events?$filter=start/dateTime ge '{{start_datetime}}' and end/dateTime le '{{end_datetime}}' and isMeeting eq true and type eq 'meeting'
如果需要排除极少数特殊场景(比如仅创建了会议框架但未添加任何参与者的草稿),可以在通过接口获取结果后,在本地二次筛选attendees集合不为空的条目——因为MS Graph暂不支持在服务器端直接过滤集合的长度或内容。
内容的提问来源于stack exchange,提问作者Jan Doggen
相关产品推荐
相关产品推荐

