cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jbungay
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 gmail.com. 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?

 

Capture.PNG

3 REPLIES 3
tom_riha
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. ]
jbungay
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 https://aka.ms/logicexpressions#endswith for usage details.'.

Capture.PNG

 

 

jbungay
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

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (29,948)