Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Condition statement using Office 365 users

Hi all,

I am new to Power Automate/Flow. I trying to get a list of users for my company into a excel file. I see a lot of other accounts in office users, so I just trying to filter unwanted users by email. I am having problem with filtering. 
1. I don't see a way I can filter on a partial email like I am assuming it can't be done in the connecter itself

2. Next, I tried a conditional loop, I can't get the condition to work. What I am missing?



Super User II
Super User II

Hello @jbungay ,

you're right, you can't filter directly in the 'Search for users' action.

If you want to filter, you can use either the 'Condition' as you do, or you can use 'Filter Query' action that will take the array with all the users and return an array only with users who fit the condition. But in both cases you want to use 'Email' dynamic content and not 'body'. 'body' is an object that contains all the available information for each user, name, surname, email..., you want to use only the 'Email' in the condition.

[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]
Frequent Visitor

Thanks for the response. I had email there originally and that doesn't work either. I get the following error.  Unable to process template language expressions for action 'Condition' at line '1' and column '16231': 'The template language function 'ends With' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see for usage details.'.




Frequent Visitor

Thanks for your help, I figure it.  Once I knew I was on the right track. The problem was one of the users had a new email and had to add a second condition to check for null  

Helpful resources

MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (996)