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

Correct Filter Query for SharePoint Get Items where I need to find the previous event date

Hi All,

Please help me to find the correct filter to be applied in get items, if I want the previous details of event occurred in SharePoint calendar. For eg: if schedule some event today in my SharePoint calendar i want the details of previous event  which occurred on some days ago. I am using this filter query in get item it is showing error. Basically i am thinking to use getItem , to put the calendar list name , and to use filter query to fetch the latest event details whose start date is less than the current event start date Anybody have idea.

 

Capture1234.PNG

3 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted

@JohnAageAnderse 

See my screen shot below - EventDate is the internal name for start date in a standard SP calendar.

While the screen shot will directly answer your question, I don't believe that this will work for you if you have repeating events in the calendar due to how SharePoint stores the data.

FlowCal1.png

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

Highlighted

Hello @priya93 

Your Filter Query has to use the comparision "lt" (less than) instead of "le" (less than or equal to) - then you will get the event that is before your event date.

Kind regards, John

View solution in original post

Highlighted

Really Thanks @JohnAageAnderse . It worked 😀

View solution in original post

18 REPLIES 18
Highlighted
Helper I
Helper I

Hi All,
If anybody knows the solution can you please help me as it is very urgent.

Thanks and Regards,

Highlighted
Super User II
Super User II

Hello Priya93

I see some issue that needs to be corrected:

  1. The column name "Start Time" - you have to use the column's internal name. No spaces are allowed in column names the Filter Query field.
  2. The Order By field also must use the column's internal name.
  3. The Order By field used "asc" for ascending and "desc" for descending, so change your "dsc" to "desc".

Hope this helps you on the way 🙂

John

Highlighted

@priya93 

Can you provide some more details on what you mean by previous event? How can it be identified?

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Highlighted

Hello ScottShearer

The screenshot says it all - get the top event that has a start time less than or equal to the variable Start Date, order by start time in descending order.

 

That will get the previous event (or at least one of them).

Kind regards, John

Highlighted

@JohnAageAnderse 

See my screen shot below - EventDate is the internal name for start date in a standard SP calendar.

While the screen shot will directly answer your question, I don't believe that this will work for you if you have repeating events in the calendar due to how SharePoint stores the data.

FlowCal1.png

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

Highlighted

Hello @ScottShearer 

Thank you for the correction of my understanding 🙂 Now we just have to wait for @priya93  to report back on whether or not the issue has been resolved. It could work if they are not using recurring events.

Kind regards, John

Highlighted

Hi ,
Thanks for replying. Now my flow is working fine. But unable to get the desired data attached is the screenshot
Capture456.PNG

Highlighted

Hi  @ScottShearer  & @JohnAageAnderse 

As in the last post p/422028#M341https://powerusers.microsoft.com/t5/Help-with-the-Forum/Correct-Filter-Query-for-SharePoint-Get-Item... , my flow is working fine but unable to get the desired result i want. For eg: i have scheduled meeting on sharepoint calendar on today, i want the details of previous meeting details which was scheduled before this meeting eg: 18th dec.

Highlighted

Hello @priya93 

Please provide more information about your steps - can't see what you are trying to do!

Is the list you are getting items from a calendar?

How does the Filter Query field look like and what is the actual value you are using in the field?

Do you or the account that runs the flow have permissions to read from the calendar?

I just tried doing what you are trying and it works for me! No recurring meetings though in my calendar 🙂

Kind regards, John

Highlighted

Hi @JohnAageAnderse ,
Thanks for replying. I have added answers .

Is the list you are getting items from a calendar? - Yes

How does the Filter Query field look like and what is the actual value you are using in the field?- 
The filter query i am using the same in screenshot above EventDate le '@{variables('start date')}', T have stored the start date of meeting in a variable named startdate. i am trying to fetch the last event whose start date is less than current event date, so that i want to fetch the details of last event , store it  update the  current event fields with last event details.
Do you or the account that runs the flow have permissions to read from the calendar?- Yes, i am sharepoint admin and flow i think it have permision, don't know exactly how to check that whether my flows that permission or not. but when i run the above workflow it was working fine, but not getting the desired result

I just tried doing what you are trying and it works for me! No recurring meetings though in my calendar? Can u please share the screenshots.

Highlighted

Hello @priya93 

Here is my screenshot with a manually entered date value!

Flow.Get calendar events.png

Use a compose action to evaluate the variable that you are using, so we can see what value you have in the variable!

 

Kind regards, John

Highlighted

Hi @JohnAageAnderse ,
Thanks for replying , can you please show me the output you got in get items. Like i got like this below.


Capture456.PNG

Highlighted

Hello @priya93 

In your screenshot, please include the Filter Query field, so we can see the resolved value from the variable!

I see that your output does not get a status code nor a body - no idea why that is so for you 🙂

Flow.Get calendar events.png Kind regards, John

Highlighted

Hi @JohnAageAnderse ,
Thanks for replying, sorry for above screenshot. Here i have attached the screenshot with body, but i am getting the event details that i have created, it is not showing before event, in body i am getting the same event details that i have created within the same flow.
Capture12345.PNGCapture1236.PNG

Highlighted

Hello @priya93 

Your Filter Query has to use the comparision "lt" (less than) instead of "le" (less than or equal to) - then you will get the event that is before your event date.

Kind regards, John

View solution in original post

Highlighted

Really Thanks @JohnAageAnderse . It worked 😀

View solution in original post

Highlighted

@priya93 

Sorry - I didn't see you question until this morning and I'm glad that @JohnAageAnderse was able to assist.

One cautionary note - if your calendar allows for repeating events then your calculations may not work as expected for repeating events.  This is due to how SharePoint stores calendar dates.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Highlighted

Hallo @ScottShearer  ,

 

I am new with flows so kind off dont know if this related to this or not .

Been Stuck on this problems for weeks.

I have 2 lists:

- List 1 (Offers made : name, address, etc.)

- List 2 (Offers accepeted or not)

 

Each order has a paticular Offer number (not item ID of sharepoint) .

 

What i want is when a new item is created in List 2 and Offer number in list 2 (only the newly created Offer number not all) is equal to Offer number in list 1 (offer ID) then call data from List 1 (eg. name, adress, etc.) with same number and send email with all data saying offer is accepted or rejected.

 

Thanks in advance,

Sanket

 

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 (7,978)