Power Apps Listbox items from SharePoint list

In this Power Apps Tutorial, we’ll go over how to use the Power Apps list box control with a SharePoint list. In addition, we will cover powerapps listbox items from sharepoint list. Examples include:

  • Power Apps list box control from SharePoint list
  • Power Apps Listbox populate from SharePoint choice column
  • Power Apps list box control multiple columns
  • Power Apps Listbox patch item to SharePoint list
  • Power Apps Listbox saves multiple items to the SharePoint list
  • Power Apps Listbox update SharePoint list

Before working with Power Apps list box control using SharePoint list, we have to prepare a SharePoint list. As a result, we can use that list as our data source.

Suppose, we have prepared a SharePoint list named IT Sectors that have some columns such as Sector (Single line text), and Country (Choice column) shown below:

Example of a SharePoint list
Example of a SharePoint list

Now, we will build a canvas app on the Power Apps and connect this SharePoint list to the canvas app. To connect the above list to Power Apps, the following steps are:

  • On the Power App screen, navigate to the Add data.
  • Search SharePoint, and select SharePoint connector.
  • Select the SharePoint site address.
  • Select the desired SharePoint site.
  • Choose the specified SharePoint list.
  • Connect.
Connect a SharePoint list to PowerApps
Connect a SharePoint list to PowerApps

Now, we can find this data source in the Add data section.

Displaying the data source in PowerApps
Displaying the data source in PowerApps

This is how to connect a SharePoint data source to the Power Apps environment.

Power Apps list box control from SharePoint list

Here, we will see how to build a Power Apps list box control from the SharePoint list. Let’s populate a Power Apps list box control using the above SharePoint list’s Sector column. To build this, the following steps are:

  • On the Power Apps screen, add a List box control. Navigate to the Insert tab > Input > List box > Select. It will create a list box control with sample list box values i.e., 1,2,3.
  • Insert the below expression on the Items property of the list box control.
Items = 'IT Sectors'.Sector

Where ‘IT Sectors‘ is the name of the data source i.e, SharePoint list and Sector is the name of the SharePoint column.

See also  Power Apps Navigate Function + 16 Examples

We can see, the data from the Sector column has been listed in the Power Apps List box control below:

Power Apps list box control from sharepoint list
Power Apps list box control from SharePoint list

This is how to populate a List box control from the SharePoint list within the Power Apps.

Read Power Apps combo box default value

PowerApps Listbox control from SharePoint choice column

Similarly, we will see how to build a Power Apps list box control using the data from the choice column of a SharePoint list.

Here, we will build a power Apps list box control using the above SharePoint choice column i.e., Country, and the following steps are:

  • On the Power Apps screen, add a list box control.
  • Insert the below expression into the list box’s Items property.
Items = Choices('IT Sectors'.Country)

Where ‘IT Sectors‘ is the name of the SharePoint data source name and Country is the Sharepoint choice field name. As we are using the ‘choice field’ so we need to use the column name within the choice().

Now, we can see all the items from the choice field have been added to the Power Apps list box control like below:

Power Apps listbox populate from sharepoint choice field
Power Apps Listbox populate from SharePoint choice field

This is how to Power Apps Listbox populate from the SharePoint choice field

Power Apps list box control multiple columns

Do you want to work with the Power Apps list box control using multiple columns? But unfortunately, multi-valued fields are not supported by the PowerApps List Box control. Instead of using the List box control, we recommend you use a Power Apps Combo box control to work with multiple value fields.

Read Power Apps Combo box with SharePoint list

Power Apps Listbox patch to SharePoint list

Here, we will see how to patch the item(s) from the Power Apps List box control to the SharePoint list.

Case-1: Patch a single item from the Power Apps list box to SharePoint

In this case, we will see how to patch a single item from the Power Apps list box to the SharePoint list. To implement this requirement, the following steps are:

  • On the Power Apps screen, we have built a dropdown control using the Sector column. For this, we have used the below expression on the Items property of the dropdown control.
Items = Distinct('IT Sectors',Sector)
  • Next, add a list box control to the Power Apps screen and insert the below expression on the Items property to display the data from the country column.
Items = Choices('IT Sectors'.Country)
Power Apps listbox patch to sharepoint list
Power Apps Listbox patch to SharePoint list
  • To patch the selected item from the Power Apps controls (i.e., Dropdown and Listbox) to the SharePoint list, add a button control to the screen.
  • Insert the below expression on the button’s OnSelect property.
OnSelect = Patch('IT Sectors', Defaults('IT Sectors'),{Sector:Sector_dpd.Selected.Result, Country: Country_Lst.Selected})

Where,

  1. IT Sectors‘: The name of the SharePoint list.
  2. Sectors, Country: The name of the SharePoint column.
  3. Sector_dpd: The name of the dropdown control.
  4. Country_Lst: The name of the list box control.
Power Apps listbox patch item to sharepoint list
Power Apps Listbox patch item to SharePoint list

Let’s save the app and preview it. Select items from both the dropdown control as well as the list box control. (Ex: Microsoft, UK). Click on the Patch button.

Power Apps listbox to sharepoint list
Power Apps Listbox to SharePoint list

Now, we can see the item has been patched to the SharePoint list like below:

Save Power Apps listbox to sharepoint list
Save Power Apps Listbox to SharePoint list

This is how to save an item from the Power Apps Listbox to the SharePoint list.

See also  Power Automate Compose + 15 Examples

Read Power Apps combo box filter

Case-2: Patch multiple items from the Power Apps list box to SharePoint

Here, we will see how to patch multiple items from the Power Apps list box to the SharePoint list. To implement this, we will use the above Power Apps controls.

Also, set the toggle “On” to Allow multiple selections on the SharePoint list choice column i.e., Country.

Save multiple items Power Apps listbox to sharepoint list
Save multiple items Power Apps Listbox to SharePoint list

Similarly, set the toggle ‘ON’ on the ‘Select Multiple’ property of the Power Apps list box control.

Then insert the below expression on the button’s OnSelect property to patch the multi-selected items from the Power Apps list box control to the SharePoint list.

Items = Patch('IT Sectors', Defaults('IT Sectors'),{Sector:Sector_dpd.Selected.Result, Country: Country_Lst.SelectedItems})
Power Apps listbox patch multi selected items to sharepoint list
Power Apps Listbox patch multi-selected items to the SharePoint list

Let’s save it and select items from both the controls such as Sector as IBM, Country as the USA, and France. Then click on the Patch button.

Patch all selections in Power Apps list box to SharePoint
Patch all selections in the Power Apps list box to SharePoint

Now, we can find the multi-selected items within the SharePoint list below:

Powerapps patch List box values to Sharepoint list
Powerapps patch List box values to Sharepoint list

This is how to patch the Power Apps list box multi-selected values to the SharePoint list.

Read How to Patch Power Apps Combo Box

Power Apps List box update SharePoint list

Here, we will see how to update an existing item from the Power Apps List box to the SharePoint list. Suppose, we have a gallery that retrieves the data from the specified SharePoint list and a list box control outside of the gallery.

When the user selects any gallery item and then click on any item from the Power Apps list box control, the changes will reflect in the Power Apps gallery as well as the SharePoint list.

See also  How to Reset Power Apps Combo Box

For this, we will use the above SharePoint list i.e., IT Sectors, and the following steps are:

  • On the Power Apps screen, build a vertical gallery using the specified SharePoint list.
Power Apps listbox update sharepoint list
Power Apps listbox update sharepoint list
  • To highlight the selected item on the Power Apps gallery, insert the below expression on the gallery’s TemplateFill property.
TemplateFill = If(ThisItem.IsSelected, LightCyan, White)
Power Apps listbox update item in sharepoint list
Power Apps Listbox update item in SharePoint list
  • Build a Power Apps list box control to display the data from the SharePoint choice column i.e., Country.
update Power Apps listbox to sharepoint list
update Power Apps Listbox to SharePoint list
  • To update the selected gallery item with the Power Apps List box item, insert the following expression on the list box’s OnChange property.
OnChange = Patch('IT Sectors', ITSector_Gal.Selected,{Country: Lst_Country.Selected})

Where ITSector_Gal is the name of the Power Apps gallery and Lst_Country is the name of the list box control.

Power Apps listbox update sharepoint list item 1
Power Apps Listbox update the SharePoint list item

Let’s preview the app. Select an item from the Power Apps gallery and then choose any item from the Power Apps list box control. (EX: IBM > France).

update Power Apps listbox sharepoint list
update Power Apps Listbox SharePoint list

We can see this modification on the SharePoint list below:

update sharepoint list item from Power Apps listbox
update SharePoint list item from Power Apps Listbox

This is how to update an existing Sharepoint list item from the Power Apps Listbox.

Conclusion

From this Power Apps Tutorial, we learned how to bind Power Apps list box items from a SharePoint list based on different scenarios. Such as:

  • Power Apps list box control from SharePoint list
  • Power Apps Listbox populate from SharePoint choice column
  • Power Apps list box control multiple columns
  • Power Apps Listbox patch item to SharePoint list
  • Power Apps Listbox saves multiple items to the SharePoint list
  • Power Apps Listbox update SharePoint list

You may like the following Power Apps tutorials:

>