cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate I
Advocate I

How to get last two weeks of data?

I've been trying to use Microsoft Flow to fetch all the meetings I had in the past two weeks, but I want to do it periodically, so I need an ODATA filter query for the Outlook "Get Events" action to limit the amount of data received.

I'm trying with Start gt {Now-14}, but it fails to work. Does anyone know if dynamic date ranges are even possible there?

Thanks!

19 REPLIES 19
Highlighted
Community Support
Community Support

Hi @tupaschoal,

 

I think the issue here should be related with the date time format, please take a try with the following format:

Start/DateTime ge '2016-04-01T08:00'

For two weeks, try:

Start/DateTime ge '2016-04-01T08:00' and Start/DateTime le '2016-04-15T08:00'

57.PNG

58.PNG

For the syntax of the Odata filter, please see:

Resource reference for the Mail, Calendar, Contacts, and Task REST APIs

https://msdn.microsoft.com/en-us/office/office365/api/complex-types-for-mail-contacts-calendar

 

Search for "To get all the events in the user's default calendar that start on or after a specific date, you can filter on the Start property."

If you have any further questions, please feel free to post back.

Regards

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Community Support
Community Support

Adding another posts, 

If we would like to get the events from last two weeks, we might need to use the UTCnow() function and the Compose action to generate the corresponding date time.

Please check my another posts regarding the compose time:

https://powerusers.microsoft.com/t5/Flow-Forum/Start-and-end-times-when-creating-calendar-event/m-p/...

Use the adddays function instead of addhours() to switch the date range.

The formula in the Compose action should be:

"@adddays(utcnow(),-14)"

"@utcnow()"

59.PNG

60.PNG

If you have any further questions, please feel free to post  back.

Regards

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted

Hello @v-micsh-msft,

 

Thanks for the response, I didn't know how to use the Compose box and it seems integral to building complex flows.

Though the compose boxes work, I couldn't manage to make the "Get Events" filter the events properly, the filter query I used was:

 

Start/DateTime ge '2016-12-09T15:54:17.0468652Z' and Start/DateTime le '2016-12-23T15:54:17.3437361Z'

where the values come from the two compose actions you suggested. One event that I expected to be filtered (because it happened two months ago, not on the past two weeks) can be seen below (sensitive information was erased):

 

{
    "Id": "",
    "Attendees": [
      {
        "Status": {
          "Response": "None",
          "Time": "0001-01-01T00:00:00+00:00"
        },
        "Type": "Required",
        "EmailAddress": {
          "Name": "tupaschoal",
          "Address": "tupaschoal"
        }
      },
    ],
    "Body": {
      "ContentType": "HTML",
      "Content": ""
    },
    "BodyPreview": "",
    "Categories": [],
    "ChangeKey": "",
    "DateTimeCreated": "2016-09-27T17:17:45.5352294+00:00",
    "DateTimeLastModified": "2016-10-05T12:49:41.1377347+00:00",
    "End": "2016-10-05T14:00:00+00:00",
    "EndTimeZone": "E. South America Standard Time",
    "HasAttachments": false,
    "Importance": "Normal",
    "IsAllDay": false,
    "IsCancelled": false,
    "IsOrganizer": true,
    "Location": {
      "DisplayName": ""
      "Address": {
        "Street": null,
        "City": null,
        "State": null,
        "CountryOrRegion": null,
        "PostalCode": null
      },
      "Coordinates": {
        "Altitude": null,
        "Latitude": null,
        "Longitude": null,
        "Accuracy": null,
        "AltitudeAccuracy": null
      }
    },
    "Organizer": {
      "EmailAddress": {
        "Name": "tupaschoal",
        "Address": "tupaschoal"
      }
    },
    "Recurrence": null,
    "Reminder": null,
    "ResponseRequested": true,
    "ResponseStatus": {
      "Response": "Organizer",
      "Time": "0001-01-01T00:00:00+00:00"
    },
    "SeriesMasterId": null,
    "ShowAs": "Busy",
    "Start": "2016-10-05T12:30:00+00:00",
    "StartTimeZone": "E. South America Standard Time",
    "Subject": "",
    "Type": "SingleInstance",
  }

 
Thanks (:

Highlighted

Hi @tupaschoal,

 

Thanks for the update.

I didn't noticed this as the calendar didn't contain any older events when I tested it before.

Just tried this time and I got the same results as yours.

The Get Events Action seems to ingore the Query inputed, I will take a further investigation on this.

Regards

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted

Hello @v-micsh-msft, thanks for the quick reply (once again!). Please do let me know when you have a fix or workaround for it 🙂

Highlighted

Any update on this matter @v-micsh-msft?

Highlighted

Hi @tupaschoal,

 

Apologize for the late response.

No helpful results currently.

No matter how I change the format, the results are always the same. I will confirm the Odata Query part with others.

I will update here once I have any response.

Appreciate your patience.

Regards

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted

Thank you @v-micsh-msft, I'm just anxious to get this working 😛

Have you considered that the filter might be ignored (incomplete implementation)?

Highlighted

Hi @tupaschoal,

 

I got the response, confirmed the behavior that the filter Query is not working.

There should be changes (currently I didn't get any result regarding how it would be changed) be made on the filter query part.

Apologizes for the inconvenience caused by this.

Regards

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted

Thanks @v-micsh-msft. So basically it is a known bug with no ETA? That's sad.

Highlighted
Microsoft
Microsoft

I'm also interested in hearing when this bug is fixed.

Highlighted

Seems like it isn't gonna happen @michowl 😞

Highlighted
Microsoft
Microsoft

@v-micsh-msft this bug needs to be fixed for the Outlook calendar Retrieve behavior to be much use. Please elevate this bug. I have 3 Flow scenarios waiting for this fix.
Highlighted

Hi @tupaschoal,

 

The Flow team are working on this, but yes, currently there is no ETA.

 

@michowl,

 

Please consider submit this as an idea. I will vote for it, which I think is a much efficient way than what I could do from my side.

 

Regards

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted

@v-micsh-msft@tupaschoal

I've posted a Flow Idea to support this bug. Please support it at the following link:

https://powerusers.microsoft.com/t5/Flow-Ideas/Filter-Outlook-Events-by-date/idi-p/23361

Highlighted

Voted, @michowl.

@v-micsh-msft I just find it weird that we have to submit an idea when it is clearly a bug 😞

Highlighted

Is there any update on this issue? The Outlook connector Get Events action is useless without filtering.

Highlighted
Anonymous
Not applicable

Any update?

Highlighted
Frequent Visitor

Has there been any updates on this matter? I'm trying to get entries from the past month on a SharePoint list and this seems relevant.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (9,615)