Ben
Ben

Reputation: 13352

How to write an odata time period filter in a logic app to access Outlook Calendar events?

I would like to get events that start today out of an Outlook calendar. I don't know how to translate the format of the queries used in the API calls into that which the Logic app expects.

I've tried things like

enter image description here

The data is a list of objects that look like this, according to the logic app's post-run viewer:

{
    "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": "[email protected]",
    "timeZone": "UTC",
    "seriesMasterId": null,
    "categories": [],
    "webLink": "https://outlook.office365.com/owa/?itemid=AAxxD&exvsurl=1&path=/calendar/item",
    "requiredAttendees": "[email protected];",
    "optionalAttendees": "[email protected];",
    "resourceAttendees": "",
    "location": "",
    "importance": "low",
    "isAllDay": false,
    "recurrence": "none",
    "recurrenceEnd": null,
    "numberOfOccurences": null,
    "reminderMinutesBeforeStart": 960,
    "isReminderOn": true,
    "showAs": "free",
    "responseRequested": false
  },

There are two linked parts to this question:

Upvotes: 0

Views: 1281

Answers (1)

Hury Shen
Hury Shen

Reputation: 15734

You can just use the filter query as below to do this operaion:

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

Of if you don't want the time, it's ok if use the query below:

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

If you want to use utcnow() in logic app, please refer to the screenshot below:

enter image description here

The two expressions of formatDateTime() in the screenshot are:

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

Please pay attention to the symbol ' before and after the formatDateTime() expression in screenshot.

Hope it helps~

Upvotes: 1

Related Questions