Use PowerShell to remove a Custom Canvas App Form from a SharePoint list

  1 min read  

OK so you’re working on modern lists in SharePoint, you’ve discovered the integrations you can do between SharePoint and Power Platform. You’ve gone and changed a SharePoint list’s default form to a Canvas App, using the Integrate button > Power Apps > Customize forms

To remove the custom form, you can browse to the List Settings, open the Form settings link, and check Use the default SharePoint form in Form Options.

There are times you might want to use PowerShell to do the same thing. For example, if you want to check how many lists in a tenant have custom Power Apps forms, you could use the PowerShell PnP cmdlets to iterate over every list in every site.

After connecting to your tenant with the PnP PowerShell’s Connect-PnPOnline cmdlet, you can use the *-PnPPropertyBag cmdlets to read, change, and remove the custom form configuration.

This command checks a list in the current site, using the list’s site-relative URL /Lists/RequestForTravel:

Get-PnPPropertyBag -Folder /Lists/RequestForTravel -Key PowerAppFormProperties

This command makes a backup of the current Power App form settings, to a Property Bag key named PowerAppFormProperties_backup:

Set-PnPPropertyBagValue -Folder /Lists/RequestForTravel -Key PowerAppFormProperties_backup -Value (Get-PnPPropertyBag -Folder /Lists/RequestForTravel -Key PowerAppFormProperties)

And finally, this command removes the custom Power Apps form reference from the list:

Remove-PnPPropertyBagValue -Key PowerAppFormProperties -Folder /Lists/RequestForTravel

Any time changes are made to a list with these commands, the local browser storage needs to be reset for anyone browsing the list, so the previous settings are no longer cached. This can be done in Microsoft Edge by using Dev Tools, navigating to the Application tab, selecting Storage, and clicking the Clear site data button.