cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
melikeaskin
Regular Visitor

Filter Outlook Events by Categories

Hi everyone, 

 

I am trying to build a flow that will check my Outlook calendar for the current day and create a task in To-Do for every meeting I have today that has no Category because I don't want to see the events I've categorized in my calendar such as Focus Time (Green Category) or Lunch (Purple Category) etc. in my To-Do's. 

 

I've already tried typing below expressions for the Filter Query field but none of them worked:

  • categories eq "[]"
  • categories eq []
  • "categories" eq "[]"
  • "categories" eq []
  • categories eq "false" (... and all other combinations with and without quotation marks)
  • categories eq "Green Category" --> to see if I can retrieve events with category.

Could you please check my flow below and give feedback on how to use the Filter Query functionality?

 

Outlook Events Filter Query by Category_Melike Askin.PNG

 

P.S. My flow works just fine without applying Filter Query. It runs every midnight and creates To-Do's in my designated list for the current day's events but I would like to only see the events with no category, like this event:

Outlook Events Filter Query by Category_Melike Askin (2).PNG

 

Thanks!

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hi @Expiscornovus

 

I tried filtering by Green Category (C is upper case 🙂) like your solution, and it worked.

 

I think I also found a workaround. Since I only have max 10 items in my calendar in a regular day, I did not apply Filter Query to Get calendar view of events but added a condition to create a To-Do only if Categories does not contain either of the categories. 

 

Outlook Events Filter Query by Category_Melike Askin (3).PNG

View solution in original post

Expiscornovus
Super User
Super User

Hi @melikeaskin,

 

The solution should work, nicely found. Only challenge will probably be that you need to update the flow whenever you introduce a new category in your Calendar.

 

Another approach could be to use a filter array and check if the categories field is empty.

 

empty(item()?['categories'])

 is equal to true

 

filterarray_emptycheck.png

View solution in original post

9 REPLIES 9
Expiscornovus
Super User
Super User

Hi @melikeaskin,

 

Categories is an array, which makes a bit more challenging in an OData filter query 😁

 

I just tested and this format seems to work for checking if the Green category is assigned. Keep in mind that it is case sensitive. I am still looking at the check for empty

 

categories/any(c:c+eq+'Green category')

 

Hi @Expiscornovus

 

I tried filtering by Green Category (C is upper case 🙂) like your solution, and it worked.

 

I think I also found a workaround. Since I only have max 10 items in my calendar in a regular day, I did not apply Filter Query to Get calendar view of events but added a condition to create a To-Do only if Categories does not contain either of the categories. 

 

Outlook Events Filter Query by Category_Melike Askin (3).PNG

This flow actually works. I only get events with no category with this flow right now.

 

@Expiscornovus, My question is, do you think this solution makes sense? Would it cause any problems in the future?

 

Thanks a lot!!

Expiscornovus
Super User
Super User

Hi @melikeaskin,

 

The solution should work, nicely found. Only challenge will probably be that you need to update the flow whenever you introduce a new category in your Calendar.

 

Another approach could be to use a filter array and check if the categories field is empty.

 

empty(item()?['categories'])

 is equal to true

 

filterarray_emptycheck.png

Hi @Expiscornovus,

 

When I used a filter array and check if the categories field is empty I still got all events including events with a category. 

Outlook Events Filter Query by Category_Melike Askin (4).PNG

 

Is this what you mean? Thanks!

Expiscornovus
Super User
Super User

Hi @melikeaskin,

 

The filter array setup looks ok.

 

Just to double check, what is the rest of your setup. Are you using the outputs of your filter array action in your apply to each loop?

 

applytoeach_filterarray.png

I am looking to do the same but cannot get this solution to work. When I copy and paste

categories/any(c:c+eq+'Green category')

 into my filter query box and I change it to my category name, I still get an invalid query syntax error. Am I missing something?

Hi @MLachanceDFG, the expression is case sensitive. Please don't forget to write "Green Category" instead of "Green category". 

 

Dear @Expiscornovus, I fixed my flow by using the outputs of the filter array action in next steps i.e. apply to each loop. Flow works, but for some reason for all meetings with no category are created as To-Do's but one meeting gets created as To-Do twice every time.

 

I continued with the condition scenario and it works for now 🙂 I will edit the condition in the future if I add a category. 

 

Thanks!

Unfortunately, it doesn't seem to matter what I type in for my category name, the syntax of the function itself is not being accepted as you've written it. Are you doing something advanced with it that you haven't detailed? I'm not understanding why the expression isn't valid if it's working for both of you.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,540)