Reader small image

You're reading from  Learn Microsoft Power Apps - Second Edition

Product typeBook
Published inSep 2023
PublisherPackt
ISBN-139781801070645
Edition2nd Edition
Right arrow
Authors (2):
Matthew Weston
Matthew Weston
author image
Matthew Weston

Matthew is a Microsoft 365 & SharePoint specialist from the Midlands in the United Kingdom. He has spent several years working in various Consultancy roles. Matthew is the Managing Director of Vantage 365, which fuels his love of working on projects surrounding Microsoft 365, especially those that involve SharePoint, Microsoft Teams, Power Apps, and Power Automate. This could be helping businesses find solutions for their problems or offering training to help people use these technologies better. Matthew leads the Black Country Power Apps & Power Automate user group, and the Office 365 & SharePoint User Group in the West Midlands. Matt is a Microsoft Most Valuable Professional in the field of Business Applications.
Read more about Matthew Weston

Elisa Bárcena Martín
Elisa Bárcena Martín
author image
Elisa Bárcena Martín

Elisa Bárcena Martín is currently a project leader at LogiRAIL, having previously worked as a business apps specialist at Intelequia and a project analyst at GlaxoSmithKline. As a Power Platform enthusiast with more than 3 years of experience with the Power Platform, she has steadily grown from her initial role as a developer into her project leader position. She is a scientist and teacher by vocation, loving process optimization and believing in continuous improvement and learning.
Read more about Elisa Bárcena Martín

View More author details
Right arrow

Working Offline

In the previous chapters, we discovered how to use controls, connectors, and data sources to work with data. All of this, however, has been dependent on a network connection, Wi-Fi, or mobile to be able to push and pull data. Given that apps in Power Apps are intended to be usable on a mobile device, we need to prepare our app to function without a consistent data connection.

For us to mitigate potential issues with network dropouts, Power Apps allows us to cache data locally, which means that we can continue to work without interruption if we lose the connection to our data source. In this chapter, we will look at how we can achieve this and what steps we can take to ensure that a connection loss will not mean losing our app’s ability to function. We will, therefore, look at the following topics:

  • Detecting a connection state
  • Storing and loading local data
  • Offline capability and synchronizing online
  • Lab 11

By the end...

Technical requirements

To follow along with this chapter, it is recommended that you have completed the previous labs to build our example app. You will also need to have a mobile device with Power Apps installed to test the functionality we are exploring within this chapter.

Detecting a connection state

One of the key things for making your app available offline is the ability to detect whether a network is present or not. First of all, Power Apps can detect the presence of a connection signal using a function that can then be used within the logic of your app:

Connection.Connected

This function will return a Boolean value: true meaning it is connected and false meaning it is disconnected.

Power Apps can also determine whether the connection is based on the cellular connection of the device or whether it is using Wi-Fi. If the device is using a mobile network, then it is classed as a Metered connection:

Connection.Metered

Again, this returns a Boolean value: true for a metered network or false for an alternative connection.

Both of these connection states should be considered while developing your app, as you can change the behavior of the app depending on whether the app is online or offline, and you can change the behavior...

Feedback

We are constantly looking at improving our content, so what could be better than listening to what you as a reader have to say? Your feedback is important to us and we will do our best to incorporate it. Could you take two mins to fill out the feedback form for this book and let us know what your thoughts are about it? Here's the link: https://forms.office.com/r/STtMpJAhFS.

Thank you in advance.

One of the most fundamental features of any system is the ability to secure the data that is being stored and processed. When developing any type of app, we should always keep security at the forefront of our mind, especially when our apps display or process any form of data.

We need to ensure that the users have access to only the information that they are authorized to see, and that their levels of access are not higher than what they need to be able to perform their duties.

In previous chapters, we investigated retrieving and displaying data from data sources. We will now start...

Technical requirements

To follow along with this example, you will need to have completed the previous labs.

To be able to work through the examples relating to Active Directory, you will need to have access to your tenancy Azure Active Directory (AAD) to be able to view user and group objects.

Securing your data

First and foremost the most important thing that you do with any of your apps is consider the security of the data itself. We can put a number of protections into the app that allow people to only see what we want them to see, but if they have access to the underlying data source then they could still get the data. This is extremely important to understand when using data sources such as SharePoint, where the underlying service provides its own user interface.

When using other data sources such as SQL, or Dataverse, it’s not as straight forward to be able to access the data directly, but that should be no reason why we shouldn’t still apply security to our data.

SharePoint

There are numerous ways in which permissions can be applied within SharePoint to protect data, as well as varying levels at which permissions can be applied.

Firstly, SharePoint can use groups of users to apply permissions, such as the following:

  • Its own group structure called a SharePoint...

Applying in-app security

As we build our apps, there are going to be screens that we only want our elevated users to access—for example, administration screens. To achieve this, we need to be able to distinguish users from each other and understand what roles they have available to them.

There are a number of ways in which you can achieve this depending on your exact requirements and how you want to manage your permissions. At the very basic level you can store your list of users and their roles directly within the app. If you want to drive your permissions in a slightly more managed way, then you could look at leveraging the security capabilities of the data source e.g. SharePoint lists or groups, or even move the permissions away to Active Directory security groups.

Just like with the data sources, you need to ask the question “how am I going to manage permissions?” The earlier you ask this in your app design and development, the less rework you’ll need to...

Sharing your Power App securely

When the app is first published, it will only be available to the creator; therefore, it is up to that person to grant access to anyone else that needs it. Consideration should always be given to who needs to use the app, especially if the app is built to handle sensitive data, such as personally identifiable information.

The process of giving people access to the app is referred to as sharing, and can be initiated from the File menu in the app, or from the Apps menu in the main Power Apps portal screen. Either way, we will be directed to the app Details section as shown in Figure 12.8:

Figure 12.8: The app Details screen navigation

When you share the app, you have a number of options for selecting the users you wish to share with:

  • The first is that you can name each person individually and assign them as a user or a co-owner. Users and consumers of the app, and therefore can access and use the functionality which you have created. Co-owners will also...
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Learn Microsoft Power Apps - Second Edition
Published in: Sep 2023Publisher: PacktISBN-13: 9781801070645
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Matthew Weston

Matthew is a Microsoft 365 & SharePoint specialist from the Midlands in the United Kingdom. He has spent several years working in various Consultancy roles. Matthew is the Managing Director of Vantage 365, which fuels his love of working on projects surrounding Microsoft 365, especially those that involve SharePoint, Microsoft Teams, Power Apps, and Power Automate. This could be helping businesses find solutions for their problems or offering training to help people use these technologies better. Matthew leads the Black Country Power Apps & Power Automate user group, and the Office 365 & SharePoint User Group in the West Midlands. Matt is a Microsoft Most Valuable Professional in the field of Business Applications.
Read more about Matthew Weston

author image
Elisa Bárcena Martín

Elisa Bárcena Martín is currently a project leader at LogiRAIL, having previously worked as a business apps specialist at Intelequia and a project analyst at GlaxoSmithKline. As a Power Platform enthusiast with more than 3 years of experience with the Power Platform, she has steadily grown from her initial role as a developer into her project leader position. She is a scientist and teacher by vocation, loving process optimization and believing in continuous improvement and learning.
Read more about Elisa Bárcena Martín