[英]Microsoft Graph API: Filter Calendar Events by Location
I'm trying to filter all events by a location displayName.我正在尝试按位置 displayName 过滤所有事件。 Since location is a complex property and displayName is nested, I need help on how to do this.由于 location 是一个复杂的属性并且 displayName 是嵌套的,因此我需要有关如何执行此操作的帮助。 I've tried the following but neither work.我尝试了以下但都没有工作。
https://graph.microsoft.com/v1.0/me/events?$expand=location($filter=displayName eq 'East Conference Room') https://graph.microsoft.com/v1.0/me/events?$expand=location($filter=displayName eq '东会议室')
https://graph.microsoft.com/v1.0/me/events?$filter=location/displayName/'East Conference Room' https://graph.microsoft.com/v1.0/me/events?$filter=location/displayName/'东会议室'
You can achieve what you want by using the $filter parameter in the api.您可以通过使用 api 中的 $filter 参数来实现您想要的。
Use query parameters to customize responses 使用查询参数自定义响应
I worked out your example by adapting the emails example in the documentation, which also filters by a nested parameter and compares to a string.我通过改编文档中的电子邮件示例来制定您的示例,该示例还通过嵌套参数过滤并与字符串进行比较。
Get all emails from a specific address received by the signed-in user.获取登录用户收到的来自特定地址的所有电子邮件。 https://graph.microsoft.com/v1.0/me/messages?$filter=from/emailAddress/address eq 'someuser@example.com' https://graph.microsoft.com/v1.0/me/messages?$filter=from/emailAddress/address eq 'someuser@example.com'
Therefore, for your use case, ie to only get calendar events with a location displayName equal to "East Conference Room", it would be:因此,对于您的用例,即仅获取位置 displayName 等于“East Conference Room”的日历事件,它将是:
https://graph.microsoft.com/v1.0/me/events?$filter=location/displayName eq 'East Conference Room'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.