cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jwheadrick
Frequent Visitor

O365 search - 0 or more than 1 result

I have an excel spreadsheet which has a 'User Name' column - this is a free text field.  I consume this field and do a 0365 search to pull back the users email address.  This all works wonderful, but with some conditions that we want to prevent from happening:

1.) User provided in the excel spreadsheet returns many hits in 0365.  Say for example they enter only Jason.  If there are 10 Jason's returned then i get all 10 email addresses returned.  If i restrict to top 1 then I could get an email address for the wrong Jason that is intended.  In this case, I want to email this record to a team member so that they know more than 1 result was returned and we aren't sure who the email should be sent to.  They can then update the spreadsheet for this to be sent later.

2.) Users provides a name that get zero matches.  I also want to send this record to a team member to review and fix.

3.) Blank records - I was able to get these filtered out.....however it would be nice to have all 3 scenarios grouped into one email to a team member to resolve while all other records with only one found email succeeds.

I hope that makes sense.  Let me know if anyone has a good idea.

1 REPLY 1
Super User
Super User

Re: O365 search - 0 or more than 1 result

1) do not do top 1, but instead use the resulting loop to increment a counter, if it ends up greater than 1, email them instead of doing whatever else you are doing

2) you can do the same as 1 i.e. counter = 0 or counter > 1

3) you can do a empty(your variable here) expression to check if its empty and increment your counter

 

Cheers

 

Chris

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,520)