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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Lookup from Table in C...
Power Apps
Answered

Lookup from Table in Collection

(0) ShareShare
ReportReport
Posted on by 132

hi,

 

I have collection that contain a table like this

nrd10_0-1703751041402.png

 

this is the table

nrd10_1-1703751117636.png

and make new collection from Office365Users.SearchUser based on Email in that table. this is my code

ForAll(VarPersonintcollect,Collect(Personintcollect,Filter(Office365Users.SearchUser({searchTerm:""}),UserPrincipalName = Email1.Email)));

 

Categories:
  • cdwhite Profile Picture
    1,069 Most Valuable Professional on at

    Hi @nrd10 ,

    I've replicated at my end, this is the code you need to make the new collection for all users in the variable:

    ForAll(
     VarPersonintcollect.Email1,
     Collect(
     Personintcollect,
     Filter(
     Office365Users.SearchUser({searchTerm: ""}),
     UserPrincipalName = Email
     )
     )
    );


    ------------------------------------------------------------------------------------------------------------------------------
    If I've answered your question, please mark your post as Solved. You can accept more than one post as a solution.

    If my response was a good one, please give it a Thumbs Up!

    Visit my blog: https://platformsofpower.net

  • nrd10 Profile Picture
    132 on at

    Hi @cdwhite ,

     

    the problem  is powerapps can't find "Email" Column in collection and its get error

    nrd10_0-1703753638065.png

     

  • cdwhite Profile Picture
    1,069 Most Valuable Professional on at

    Hi @nrd10 ,

    Please can you copy & paste an image of the exact error you're getting when hovering over the red underline?

    Your original images show Email1 as the parent object, with Email as the relevant child object(s). I replicated on that exact basis and the formula provided is working fine for me. Has Email1 or Email been changed to something else?

  • nrd10 Profile Picture
    132 on at

    Email1 as the parent object, with Email as the relevant child object(s) >> yes this is correct

     

    this is my code

     

    ClearCollect(VarPersonintcollect,
     {Email1:LookUp('Log Interaction_1',ID = GalleryInteraction.Selected.ID,'Internal Attendees').Email});
    ForAll(
     VarPersonintcollect.Email1,
     Collect(
     Personintcollect,
     Filter(
     Office365Users.SearchUser({searchTerm: ""}),
     UserPrincipalName = Email
     )
     )
    );

     

     

    My goal is to create a collection of Office365Users.SearchUser results that are filtered by the Person Type column (which contains multiple values) from my SharePoint list. 

     

    or maybe there is more simple way to do this? 

  • Verified answer
    cdwhite Profile Picture
    1,069 Most Valuable Professional on at

    Hi @nrd10 ,

    Thanks for the extra context. I've redrafted based on using a Person type column in SharePoint that could have multiple persons.

    In my revised method, we can remove the need to create the VarPersonintcollect collection. Instead, we can get the data we need using the With function which gives us the same result but is less resource and performance hungry. With that data, we can then use the Office 365 Users connector, but use the User Profile v2 action to get the profile for each email address retrieved inside the With function. 

    Here is the code:

    // Reset collection
    Clear(colPersonintcollect);
    // Get 'Internal Attendees' email addresses
    With(
     {
     tvData: LookUp(
     'Log Interaction_1',
     ID = GalleryInteraction.Selected.ID,
     'Internal Attendees'
     ).Email
     },
    // Loop through to add relevant user profiles to new collection 
     ForAll(
     tvData,
     Collect(
     colPersonintcollect,
     Office365Users.UserProfileV2(Email)
     )
     )
    )

     Tested my end, end result is the colPersonincollect collection where I can select any profile information for the users:

    cdwhite_0-1703775594980.png

    ------------------------------------------------------------------------------------------------------------------------------
    If I've answered your question, please mark your post as Solved. You can accept more than one post as a solution.

    If my response was a good one, please give it a Thumbs Up!

    Visit my blog: https://platformsofpower.net

  • nrd10 Profile Picture
    132 on at

    Hey, it's working perfectly! Thanks a million for your help!

  • cdwhite Profile Picture
    1,069 Most Valuable Professional on at

    You're welcome @nrd10 !

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard