首页 > 解决方案 > 如何在逻辑应用中编写 odata 时间段筛选器以访问 Outlook 日历事件?

问题描述

我想从 Outlook 日历中获取今天开始的事件。我不知道如何将 API 调用中使用的查询格式转换为逻辑应用程序所期望的格式。

我试过像

在此处输入图像描述

根据逻辑应用的运行后查看器,数据是如下所示的对象列表:

{
    "subject": "Working elsewhere (Not in the office)",
    "start": "2020-03-18T21:00:00.0000000",
    "end": "2020-03-18T21:00:00.0000000",
    "body": "plenty of writing",
    "isHtml": true,
    "responseType": "notResponded",
    "responseTime": "0001-01-01T00:00:00+00:00",
    "id": "AAMkAGJkMGY5MTQzLWVhNDAzzAAAHYoGQAAA=",
    "createdDateTime": "2020-03-19T02:44:49.558788+00:00",
    "lastModifiedDateTime": "2020-03-19T02:44:49.7419829+00:00",
    "organizer": "Clazbo@bvn.com.au",
    "timeZone": "UTC",
    "seriesMasterId": null,
    "categories": [],
    "webLink": "https://outlook.office365.com/owa/?itemid=AAxxD&exvsurl=1&path=/calendar/item",
    "requiredAttendees": "clazbo@bvn.com.au;",
    "optionalAttendees": "wherebot@bvn.com.au;",
    "resourceAttendees": "",
    "location": "",
    "importance": "low",
    "isAllDay": false,
    "recurrence": "none",
    "recurrenceEnd": null,
    "numberOfOccurences": null,
    "reminderMinutesBeforeStart": 960,
    "isReminderOn": true,
    "showAs": "free",
    "responseRequested": false
  },

这个问题有两个相关的部分:

标签: azure-logic-apps

解决方案


您可以使用如下过滤器查询来执行此操作:

Start/DateTime ge '2020-03-01T08:00' and Start/DateTime le '2020-03-25T08:00'

如果您不想要时间,可以使用以下查询:

Start/DateTime ge '2020-03-01' and Start/DateTime le '2020-03-25'

如果你想在逻辑应用中使用 utcnow(),请参考下面的截图:

在此处输入图像描述

截图中formatDateTime()的两个表达式为:

formatDateTime(utcnow(),'yyyy-MM-dd')
formatDateTime(adddays(utcnow(), 7),'yyyy-MM-dd')

请注意截图中表达式'前后的符号。formatDateTime()

希望有帮助~


推荐阅读