web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / use an email address i...
Power Automate
Unanswered

use an email address in a Filter expression in a Get Contacts action

(0) ShareShare
ReportReport
Posted on by 261
I want to filter the output of a Get Contacts action by the email address. 
 
Opposed to other properties, the actual email address is nested inside an array-based emailAddresses property:
 
      "emailAddresses": [
        {
          "name": "Joe Doe",
          "address": "joe.doe@company.com"
        }
      ]
 
I asked Copilot how to use the "address" part of the emailAddresses result, and its response was: emailaddress1, so in the Filter Query field I used the expression:
emailaddress1 eq variables('sender')
 
I have also used the expression
emailAddresses.address eq variables('sender')
 
None of that works. Any advice on how to build my Filter Query?
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Mark Nanneman Profile Picture
    991 Super User 2025 Season 2 on at
    emailAddresses is an array so you can't use it in the Odata filter.  My recommendation would be to use a different property to filter on, like "displayName"
     
    e.g.
    displayName eq 'Contact Name'


    Another thing you could do is use a "Filter Array" on the output of your Get contacts (V2)

    Then you can check if the first (or last) emailAddresses/address is equal to your filter email address.

    e.g.
    first(item()?['emailAddresses'])?['address']

    If this helped you, please click "Does this answer your question" and give it a like to help others in the community and close the ticket
    Power Platform Developer | LinkedIn: Mark Nanneman | Blog: Power Stuff  | YouTube: Mark's Power Stuff 

     
  • mobilismexico Profile Picture
    261 on at
    I understand that the array as a whole could not be used in the Filter Query expression, but the array always contains only two known elements, name and address. The Filter Query should be able to use one of those elements as the "column" name for building the expression.
     
    The Filter Array action would only work when the number of results is under the limit of 999 elements.
     
    I appreciate your reply, though.
  • Verified answer
    Mark Nanneman Profile Picture
    991 Super User 2025 Season 2 on at
    Well you learn something new every day!  Turns out that you can work with nested arrays in an Odata filter using a Lambda function

    https://www.odata.org/getting-started/basic-tutorial/#lambda
     
    if you use this filter it will return items with an address that equals whatever you put in.  I haven't gotten it to work with contains or endswith unfortunately.
     
    emailAddresses/any(s:s/address eq 'john.doe@gmail.com')
     
    Give it a try
  • mobilismexico Profile Picture
    261 on at
    thank you, @Mark Nanneman,
     
    this did the trick:
     
    emailAddresses/any(s:s/address eq 'john.doe@gmail.com')

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard