How to Display Microsoft 365 Group Members in a Power Apps Dropdown?

A few weeks ago, I created a Power Apps form for a client who wanted to assign projects to different groups in their organization using Microsoft 365 groups.

So, I was required to display the Microsoft 365 group members in a dropdown in the Power Apps form so they could see who was in the group.

In this article, I will show you how to display Microsoft 365 group members in a Power Apps dropdown. I will also explain how to get selected Microsoft 365 group members and all Microsoft 365 groups, etc.

Display Microsoft 365 Group Members in a Power Apps Dropdown

I created a Microsoft 365 group in my organization called IT Software Solutions. The members of this group are shown below.

How to get Office365 groups in Power Apps dropdown control

Now, refer to this example. The group members are shown in the Power Apps dropdown control.

display Microsoft 365 group members in a power apps dropdown

Follow the steps below to achieve this!

In Power Apps, we need to use Office365Groups.ListGroupMembers(group.id).value function to get the office365 group members.

1. In Power Apps, connect with Office365 groups from the Data in navigation.

Show members of a office365 group in a power apps dropdown

Now, we need to get the ID of the Microsoft 365 group.

2. In the Microsoft admin center -> Open Microsoft 365 group -> From the Url, copy the ID.

How to display Microsoft 365 members in a power apps dropdown

3. Add Dropdown control in Power Apps from the +Insert tab. Then, provide the below formula in the Items property of the dropdown.

Office365Groups.ListGroupMembers("22610ebf-044a-499a-b6fe-a30006c600cb7").value

Provide the group ID within the Office365Groups.ListGroupMembers(” “).value function.

display Microsoft 365 members in a power apps dropdown

4. Now, save and publish. While previewing, the members of the provided group ID are displayed in the dropdown control.

Office365 group members in a power apps dropdown field

I hope you understand getting Microsoft 365 group members in Power Apps dropdown control.

Display Microsoft 365 Groups in a Power Apps Dropdown

Let’s see how to get the Microsoft 365 groups in the Power Apps dropdown control. We need to use Office365Groups.ListGroups().value function in Power Aps to get all the groups.

The image below shows all the Microsoft 365 groups. We need to display these groups in the Power Apps dropdown control.

Refer to this example below; the above groups are displayed in the Power Apps dropdown control.

office 365 list group members power apps dropdown

To do this, follow the steps below!

NOTE:

We can use Office365Groups.ListGroups().value dierectly in gallery or data table Items property. But to display group names in dropdown we need to use Distinct().

1. Add one dropdown control in the Power Apps from the +Insert tab. Then, provide the formula below for the Items property of dropdown control.

Distinct(Office365Groups.ListGroups().value,displayName)

Instead of displayName, you can use the mail parameter to get Microsoft 365 group emails.

power apps list all office 365 groups in dropdown

2. Save the changes and preview them once. In the Power Apps dropdown control, all the Microsoft 365 groups are displayed.

Let’s see how to get the selected group members in Power Apps.

Display Selected Microsoft 365 Group Members in Power Apps Dropdown

Let me explain how to display the selected Microsoft 365 group members in the Power Apps dropdown with an example I have already achieved.

Here, I have a Power Apps form that includes the following fields.

  • Project Name
  • Office 365 Group Name
  • Office 365 Group Members
  • Assigned Date

This form allows users to assign projects to a Microsoft 365 group. While assigning projects, users can select their organization’s Microsoft 365 groups in the dropdown menu present in the Power Apps form. They can also see the selected group members in the other dropdown control.

Refer to the example below.

power apps get office 365 group members into dropdown list

I took the SharePoint list below as a data source to store all these details.

how to display Microsoft 365 members in a power apps dropdown control

This SharePoint list has the following columns.

Column NameData Type
Project NameTitle (Single line of text)
Office365 Group NameSingle line of text
Assigned DateDate and time
Follow the steps below to achieve this!
Note: In Power Apps, I took all controls separately for the form instead of the Edit form. I submit the entered data to the SharePoint list using the Patch function.

1. Add the following controls to the Power Apps screen from the +Insert tab.

  • Text input control: project name.
  • Dropdown control: Office 365 group names.
    • Name it as drp_grpnames.
  • Dropdown control: Office 365 group members.
    • Name it as drp_MeM.
  • Date Picker: Assigned date.

2. Provide the formula below in the Items property of the dropdown control used to get all Microsoft 365 groups.

Distinct(Office365Groups.ListGroups().value,displayName)
display office 365 groups in power apps drop down menu

3. To get the selected group members in other dropdown control, use the formula below in the [drp_grpnames] dropdown’s OnChange property.

// To get group id
Set(Getgroupid, LookUp(Office365Groups.ListGroups().value, displayName = drp_grpnames.SelectedText.Value).id);

//To get group members
ClearCollect(MembersOf365Group,Office365Groups.ListGroupMembers(Getgroupid).value)

The above formula describes,

  • Formula 1: I’m using the Lookup function to get the group ID I selected in the drp_grpnames dropdown and storing it in the Getgroupid variable.
  • Formula 2: Here, I’m passing the Getgroupid in Office365Groups.ListGroupMembers(Getgroupid).value function to get members of provided group id. To store these details, I created a collection named MembersOf365Group.
show members of a office365 group in a power apps drop down list

4. Now, to get the members of the selected Microsoft 365 group, provide the collection name in the Items property of the drp_MeM dropdown.

MembersOf365Group
get office 365 groups into power apps dropdown controls

Save and publish it once. You can see the selected group members in the dropdown control while previewing.

5. To submit the entered details to the SharePoint list. Use the below formula in the submit button OnSelect property.

Patch('Projects For Office 365 Groups',Defaults('Projects For Office 365 Groups'),{Title:txt_PN.Text,'Office 365 Group Name':drp_grpnames.Selected.Value,'Assigned Date':DatePicker1.SelectedDate})

The Patch() function will submit the details entered into the SharePoint list.

how to show office365 group names in to power apps dropdown menu

Now, save all changes and publish it. You can submit the provided details to the SharePoint list.

I hope you found this article helpful. I have explained how to get Microsoft 365 groups and group members in the Power Apps dropdown control.

Follow this article while you’re searching these topics in Power Apps.

Also, you may like:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…