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 Apps / Combining Office365Use...
Power Apps
Answered

Combining Office365Users and Office365Groups

(0) ShareShare
ReportReport
Posted on by 277

Greetings everyone,

 

I have a form that includes a combobox of secretaries, and I need to display in that combobox only the secretaries who are active, and are internal accounts, and belong to the secretaries group. I mean to create a secretary picker.

 

The combobox cannot allow multiple selections, and I must display only names and emails. However, when saving the record in the SharePoint list, I need to store the user's ID. For instance, if I select Luisa Lane, whose email is llane@mycompany.com, I should save only 'llane' in the list.

 

I know I can achieve this using Office365Users and Office365Groups, but I'm not sure how to combine both functions.

 

Someone suggested that I could proceed this way:

 

 

// Step 1: Retrieve and filter users
ClearCollect(
 FilteredUsers,
 Filter(
 Office365Users.SearchUserV2(
 {
 searchTerm: Trim(Self.SearchText),
 isSearchTermRequired: false
 }
 ).value,
 AccountEnabled = true && Not("#EXT" in UserPrincipalName)
 )
);

// Step 2: Retrieve group members
ClearCollect(
 GroupMembers,
 Office365Groups.ListGroupMembers("53d2e2dd-cdcd-4d58-86a7-56dd248d4e52").value;
 Office365Groups.ListGroupMembers("da6aeda1-d6a9-474c-a2f9-b37347cb0937").value
);

// Step 3: Match and filter
ClearCollect(
 FinalFilteredUsers,
 Filter(
 FilteredUsers,
 // Check if the user is in the group members list
 LookUp(GroupMembers, mail = UserPrincipalName) <> Blank()
 )
);

 

 

However, I'm encountering numerous errors. I have the impression that everything revolves around collections, but I'm uncertain about what steps I should take.

 

This might be quite obvious or basic for some, but for me, it's a new concept, which is why I'm seeking help.

 

I wonder if someone could guide me on this.

 

Thank you very much in advance.

1-1701356278313.png
2-1701356344063.png
Categories:
I have the same question (0)
  • v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @ADumith,

    For the GroupMembers, modify as below:

    ClearCollect(
     GroupMembers,
     Office365Groups.ListGroupMembers("53d2e2dd-cdcd-4d58-86a7-56dd248d4e52").value,
     Office365Groups.ListGroupMembers("da6aeda1-d6a9-474c-a2f9-b37347cb0937").value
    )

    For the finla collection, modify as below:

    ClearCollect(
     FinalFilteredUsers,
     Filter(
     FilteredUsers,
     // Check if the user is in the group members list
     mail in GroupMembers.UserPrincipalName && mail<>Blank()
     )
    );
  • ADumith Profile Picture
    277 on at

    Hello, 

    Thank you for your response.

     

    I applied your recommendations, but for some reason is still not working.

    ADumith_2-1701724323582.png

    I'm sorry but I don't get what I'm doing wrong

     

    Thank you again.

  • v-qiaqi@microsoft.com Profile Picture
    on at

    HI @ADumith,

    Which control and which property you set for this formula?

    OnChange property of a ComboBox?

     

    I have tested on  my side, where I set your first ClearCollect() function for the OnChange property of the ComboBox, and it works.

    vqiaqimsft_0-1701744590443.png

     

    Further, try to change the collection name for avoiding duplicated.

  • ADumith Profile Picture
    277 on at

    Hello!

     

    That makes all the sense in the world, I was placing that formula in the Items property, could you explain me step by step? I mean what value should I put in each property.

    ADumith_0-1701788012534.png

    The formula still has errors, I show them to you


    The combobox is inside a card and at the same time it is inside a form.


    Thank you very much and sorry for the abuse.

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @ADumith,

    You have error on gthe Update property, which I don't know how you configure it.

    I think you should try steps by steps, I could not help you solve all the problems in your process😂

     

    Items property expects a table value, OnChange property expect behaviour formula, so does the Update property

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 Apps

#1
Kalathiya Profile Picture

Kalathiya 419

#2
WarrenBelz Profile Picture

WarrenBelz 397 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 345 Super User 2025 Season 2

Last 30 days Overall leaderboard