Set custom display form for SharePoint list

20/07/2015 17:46

Set your custom application page url on content type and if your list uses this content type, form will be associated too. If trying to set this application page url to list property DefaultDisplayFormUrl, I got errors of SPForm file not found


Add-PSSnapin microsoft.sharepoint.powershell -ea 0
$webUrl = "https://yoursitecollectionurl"
$ctName = "Item"

$web = Get-SPWeb $webUrl

$contentType = $web.ContentTypes[$ctName]
$contentType.DisplayFormUrl = "_layouts/yourLocation/YourCustomApplicationPage.aspx"
$contentType.Update($true);
$web.Update()