Power Apps and Microsoft 365 Lists basics

a purple and white logo

This is a brief blog of what I've learned from my first day interaction with Power Apps creation.


List items from SharePoint List into your Power App


Here is my first interaction with PowerApps. I had to display list items from a Microsoft 365 List. It should have re-order functionality too.

graphical user interface, application

How do we get data from Microsoft 365 List into a Power Apps app?


First add a data source. It is straight forward as shown on the picture below.

Attach data source to PowerApp application

Use Gallery to display the data


This is how I managed to fetch data from Microsoft 365 List into a PowerApp. Select the first row of the inserted Gallery and then specify a filter formula (query) to get data based on specific filter rule. Sorting on the front is done based on the order of the items so it can display the items in the correct order. I have a custom number column within the list to store the order number if you are wondering. The marked in yellow label is the name of the Microsoft 365 list, which will appear automatically when you are typing the formula if the list connection exists within the data sources.

graphical user interface, text, application, email

Interesting read here is regarding how data can be fetched from data sources and what is "Delegation" in PowerApps.

Working with big data sets might have implications since PowerApps Gallery is trying to do search, filtering and sorting on the client, but there is a way to delegate that to the data source compute. I found interesting few articles related to delegation Understand delegation in a canvas app - Power Apps | Microsoft Docs and SharePoint - Connectors | Microsoft Docs.


Create a Power Apps Gallery re-order functionality with few lines of code


Selecting the gallery will allow you to insert icons and position them properly. Select the newly added icon from icons and in the formula tab paste the following.


Select(Parent);
UpdateContext({prevItem: LookUp('Work Items List', Order0 = ThisItem.Order - 1)});
Patch('Work Items List', prevItem, { Order0: ThisItem.Order });
Patch('Work Items List', ThisItem, { Order0: prevItem.Order0 });


Notable is the UpdateContext will store local variable prevItem to be used later to swap order between items. Patch will preform update on the Microsoft 365 List once the button is clicked so the Order number between the previous item and the current item will swap. Moving item down in the order is the same code applied to the other arrow icon with small difference.


Select(Parent);
UpdateContext({prevItem: LookUp('Work Items List', Order0 = ThisItem.Order + 1)});
Patch('Work Items List', prevItem, { Order0: ThisItem.Order });
Patch('Work Items List', ThisItem, { Order0: prevItem.Order0 });


Get the field properties and use them to display data in labels


Another useful feature was the advanced panel of every element giving me the chance to see the internal names of the elements.

graphical user interface, application, Word

Having that info gives me quick option to turn inputs into readonly fields, labels or headings like this one below.


timeline

Open Link from a Label in Power Apps app


Another useful function is to open a link from an app by using the lunch functionality. Launch("teams.microsoft.com")


Launch("teams.microsoft.com")
graphical user interface, application

Conclusion


Working with PowerApps app is fun and I expected a lot bigger learning curve, but having some knowledge in SharePoint, Microsoft 365 Lists, how APIs work in Microsoft 365 gave me quite a confidence to rapidly build an app.


Power Apps definitely have place in todays modern workplace since applications can be build rapidly and at a less cost as you would have paid for a developer to do that with custom code.


My aim behind using Power Apps app is not to build solution to last for years, but rather a rapid simple solution that can be re-created quickly in a case of disaster. Solution that can quickly change based on new requirements so you can even completely throw away one app and create another to comply with the dynamic nature of the business.