Assign PowerApp canvas form for a new item creation in SharePoint Online
Visit our website to find out more useful solutions and services from Chiron IT https://chironit.com
There are two types of PowerApps: Form and Canvas. If you just modified the list item view form you will see a lot of limitations on available functionality. So, you might want to create a Canvas app instead.
If you created the Canvas type PowerApp it will always be opened from the PowerApp site. What if you want your users to a user that PowerApp when they click on the New Item or Edit buttons in the list from SharePoint Online?
You can use the PowerShell script provided below and it will make a trick.
Pre-requisitions:
- You need to have at least site collection admin permissions
- Run PowerShell ISE with admin privileges on your local machine- Install pnp
Install Module SharePointPnPPowerShellOnline
The script itself is here
Connect-PnPOnline -url https://CONTOSO.sharepoint.com/sites/
dev -UseWebLogin
$list = Get-PnPList “EUTX Architecture Services”
write-host $list.Name
$contenttypes= Get-PnPContentType -List “EUTX Architecture Services”
foreach($cc in $contenttypes)
{
Write-Host $cc.Name
If ($cc.Name -eq “Item”){
$cc.EditFormUrl = “SitePages/ItemEditForm.aspx”
$cc.NewFormUrl = “SitePages/ItemEditForm.aspx”
$cc.Update($false)
}
}
# assuming list content type 0 == Item
# otherwise, you need to set this on the correct list content type
# no update child content types
# you may have to set $true if you have content types in your list
$context = Get-PnPContext
$context.ExecuteQuery()