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

Office365Outlook V4CalendarGetItems filter by string

Hello,

I am trying to get the Office365Outlook.V4CalendarGetItems to filter events that have a specific keyword (in this case, a project ID). I am getting an invalid filter clause message. Any thoughts on what I need to do differently?


Office365Outlook.V4CalendarGetItems(
ProvCalendar,
{'$filter': "substringof(body, '" & ActiveProject.WorkOrderId & "')"}
).value


ProvCalendar - this is a variable containing the calendar ID. It is correct as it works elsewhere in the app in this function.
ActiveProject.WorkOrderId - this is a variable containing a string with the work order ID that I want to filter for.

I've also tried ActiveProject.WorkOrderId in body with no success either.


Ideally, I'd search subject and body, but I will settle for just one for now as the other should work the same way (or so I am assuming).


Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @kcordell ,

 

If you want to learn more about Odata filter, please review these blogs Basic Tutorial System Query Option $filter 

However, the body of event doesn't support filter, reference from here, so the formula returns the error of invalid filter clause.

Snipaste_2020-08-03_15-32-52.png

 

In addition, the Subject of event is filterable, and the Contains() function is more suitable, so the odata filter is like this:

 

Office365Outlook.V4CalendarGetItems(
ProvCalendar,
{'$filter': "Contains(subject, '" & ActiveProject.WorkOrderId & "')"}
).value

 

Hope this helps.

Sik

View solution in original post

3 REPLIES 3
v-siky-msft
Community Support
Community Support

Hi @kcordell ,

 

Actually, you can try to use Filter() function to filter the events. Please try with this.

Filter(Office365Outlook.V4CalendarGetItems(ProvCalendar).value, ActiveProject.WorkOrderId in subject || ActiveProject.WorkOrderId in body)

 Hope this helps
Sik

Thank you -- and this has been my workaround, but I was trying to offload that to server-side using the built in ODATA filter. Using Filter() in this context seems to pull in all results, then process locally making the app super sluggish. Maybe I am wrong in that assumption, but that is how it appears from user side.

No one seems to have a good answer for using the ODATA filter, which makes me wonder why they even have it if there is no good documentation for it.

Hi @kcordell ,

 

If you want to learn more about Odata filter, please review these blogs Basic Tutorial System Query Option $filter 

However, the body of event doesn't support filter, reference from here, so the formula returns the error of invalid filter clause.

Snipaste_2020-08-03_15-32-52.png

 

In addition, the Subject of event is filterable, and the Contains() function is more suitable, so the odata filter is like this:

 

Office365Outlook.V4CalendarGetItems(
ProvCalendar,
{'$filter': "Contains(subject, '" & ActiveProject.WorkOrderId & "')"}
).value

 

Hope this helps.

Sik

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,007)