Power Apps as a Front End
There are two different ways that you can create PowerApps canvas apps. There are customized SharePoint list forms, and there are standalone PowerApps. I always prefer standalone, and I wrote a post that is a full comparison between the two types, PowerApps Standalone App Versus Customized List Form. Whenever I’m talking about the fact that I prefer standalone over customized list forms, someone always asks… “What about when end users go to the list?”. When we create a standalone app as the front end interface to the list, we want to prevent people from directly accessing the SharePoint list. There are several different techniques that you can use, to accomplish this, to ensure that any time someone is adding or editing items in the list, it is only from the PowerApp. This isn’t a step-by-step list of actions to take, this is a list of suggestions and how to accomplish different ways of locking down the list. The reason this is so tricky, is that in order for people to be able to add and edit items in the list, they need to have at least “Contribute” permission to it, but then they can see the list when they view all site contents of the site it’s in, and they can find it via search. Maybe Microsoft will provide some other way to accomplish this soon, but as of now, these are some options.
- Create a redirect button in the existing list items. First you’ll need the web url to your standalone PowerApp. Go to web.powerapps.com, select your app’s drop-down, and click on the Details screen. That’s where you’ll find its Web link. Go to your SharePoint list, and although you haven’t customized the list form, go ahead and click to customize the list form with PowerApps. Delete the form control, and add a big button. For the button’s OnSelect property, use the Launch function, to take them to your standalone app. That’s the web link I was talking about. Save and publish this app. With this method, if people end up on the list, and try to create a new item or edit an item from there, they’ll only get this big button to take them to the correct app.
- Disable Quick Edit (datasheet view). Go to your list’s settings, click advanced settings, and for the setting called Quick property editing, change it to NO. This way, no one can directly edit the list right on the page.
- Show them nothing. If you don’t want any items to show when people go to the list, filter it. Go to your list’s all items view settings, and filter so that ID is equal to zero. That way, nothing will ever show. Delete all other views.
If you use this method, you’re going to want to prevent people from creating more views, too. To prevent people from creating views, you’ll have to create a custom permission level.
Create a permission level by copying an existing permission level. Copy the contribute permission level, and call your new level something else, like “contribute not create views”. The important thing to uncheck, is Manage personal views. You can even uncheck “create alerts” if you want to prevent them from creating SharePoint alerts for themselves.
Note that I’m only telling you to create this permission level for use on this one list. This is not something that needs to be applied at the whole site level. Go to your list settings, and click Permissions for this list. At the top, click Stop inheriting permissions. Check the box next to the group of people who you want to be able to add and edit items in this list, and change their permission level to the one you just created.
- With the options that I’ve told you so far, users will still be able to find your list and items via search in SharePoint, and when they click on an item in the search results, and open it, they will be taken to that lovely giant button that will take them to the standalone app.
If you’d like to prevent people from finding your list via search, you can go to the list’s advanced settings, and set Allow items from this list to appear in search results to NO.
- What if you DO want people to be able to go to your list in SharePoint, but when they click an item, you want it to take them to that item in your standalone app? April Dunham wrote a genius post about that, called Open PowerApp using SharePoint Column Formatting, where she teaches you how to use the Param function to pass an ID parameter to the item, and also create a custom hyperlink on each list item that will open that item in the Standalone app! I took that example, and made my own version of it, as view formatting (click all items and choose format current view) instead of column formatting. It only shows the title, as a hyperlink, and none of the column headers or out of box drop-downs and options. The part in blue in the code there, is where you put the full web link to your app, after you’ve followed April’s post and created a parameter in your app.
“schema”: “https: //developer.microsoft.com/json-schemas/sp/view-formatting.schema.json”,
Here’s what it looks like:
There is also a PowerShell method that Pieter Veenstra mentions in this post, that you can use when you’re creating the list.
Where did I figure out how to customize the view like that? I’m not a dev! Here’s a long list of code samples, of different ways of displaying views: