cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

Office365 Getting a Certain Group

I was able to get all my users that ever existed in my company to appear in a dropdown menu using this code and this allows me to search all the employees b/c I have more than 100 employees i needed to setup a text search box since there is a limit on how many people show up.

 

Office365Users.SearchUser({searchTerm: TextInput1.Text})

This works how I wanted it to be.

 

Now I want to create another dropdown that shows employees in certain departments. For Instance we have a Trust group created with 5 people in it. I only want those 5 people to show up in that dropdown. Not to sure how to go about that. I've seen some things that have said you need a group id? Not to sure where that would be located.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Office365 Getting a Certain Group

Hi @alex5p ,

Do you want to use Office 365 Groups connector within your app?

 

If you want to use Office 365 Groups connector within your app, please consider take a try with the following workaround:

Set the Items property of the Dropdown1 to following formula:

Office365Groups.ListOwnedGroupsV2().value

set the displayName column as display value within the Dropdown1 box.

 

Set the Items property of the Dropdown2 to following formula:

Office365Groups.ListGroupMembers(Dropdown1.Selected.id).value

set the displayName column as display value within the Dropdown2 box.

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Highlighted
Dual Super User
Dual Super User

Re: Office365 Getting a Certain Group

Hi @alex5p 

 

One way to get the group id is : 

go to portal.azure.com

Select Azure Active Directory

Select Groups

This will list all the groups in your tenant - the list also includes the obkect ID for each group

the object ID is the group ID you need to get the members

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Highlighted
Community Support
Community Support

Re: Office365 Getting a Certain Group

Hi @alex5p ,

Could you please share a bit more about your scenario?

Do you want to display employees in a certain group within the second Dropdown box?

 

Based on the needs that you mentioned, I think two Dropdown controls could achieve your needs. Firstly, you need to get the group id of your certain group, and then get members from this group based on the group id.

 

I have made a test on my side, please take a try with the following workaround:

Firstly, add Azure AD connector as data source within your app.3.JPG

 

4.JPG

 

5.JPG

Set the Items property of the App to following formula:

ClearCollect(
GroupsCollection,
AddColumns(
AzureAD.GetMemberGroups(User().Email,false).Value,
"GroupName",
AzureAD.GetGroup(Value).displayName
)
)

Add two Dropdown controls in your app, set the Items property of the Dropdown1 to following formula:

GroupsCollection

set the GroupName column as display value column.

Set the Items property of the Dropdown2 to following formula:

AzureAD.GetGroupMembers(Dropdown1.Selected.Value).value

set the displayName column as display value column.

When you select a different group within the first Dropdown box, the corresponding employees would be populated within the second Dropdown box.

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper III
Helper III

Re: Office365 Getting a Certain Group

I would use this way however won't users who use this application need to have access to azure ad? I am pretty sure only IT admin(myself and others) only have access to that connector. Is there a way to use office365groups to pull all the departments and have a dropdown to show which people are in each department. For instance if you look up the Trust department in dropdown menu and  say 5 people should show up in another dropdown menu named alex, nancy, ron, bob, and kathy. 

Highlighted
Community Support
Community Support

Re: Office365 Getting a Certain Group

Hi @alex5p ,

Do you want to use Office 365 Groups connector within your app?

 

If you want to use Office 365 Groups connector within your app, please consider take a try with the following workaround:

Set the Items property of the Dropdown1 to following formula:

Office365Groups.ListOwnedGroupsV2().value

set the displayName column as display value within the Dropdown1 box.

 

Set the Items property of the Dropdown2 to following formula:

Office365Groups.ListGroupMembers(Dropdown1.Selected.id).value

set the displayName column as display value within the Dropdown2 box.

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (6,917)