Skip to main content
Nintex Community Menu Bar

SharePoint List Nintex Edit from is not loading

  • March 26, 2021
  • 0 replies
  • 84 views

Forum|alt.badge.img+8

Issue

The customer is able to load New, and display mode. When trying to access editform.exe either half the form loads or the page won't load at all. 

 

Resolution

The following scrip was successfully used to rebuild all three forms.

This script is used to rebuild the default SharePoint forms if they have been removed/deleted or if the user has modified any of the .aspx pages.

Add-PSSnapin microsoft.sharepoint.powershell

$url = "enter site url"

$listname = "enter list name"
$web = get-spweb $url
$list = $web.lists[$listname]
$files = $list.rootfolder.files
 
#---------------------------- Delete Forms ----------------------
 
$form1 = $list.RootFolder.files | ?{$_.url -match "dispform.aspx"}
 
$form2 = $list.RootFolder.files | ?{$_.url -match "editform.aspx"}
 
$form3 = $list.RootFolder.files | ?{$_.url -match "newform.aspx"}
 
$form2.delete()
$form1.delete()
$form3.delete()
 
$list.update()
 
# --------------------------recreating --------------------------------
 
$editformurl = $list.RootFolder.ServerRelativeUrl + "/EditForm.aspx"
$dispformurl = $list.RootFolder.ServerRelativeUrl + "/DispForm.aspx"
$newformurl = $list.RootFolder.ServerRelativeUrl + "/NewForm.aspx"
 
$dispform = $files.add($dispformurl, [Microsoft.SharePoint.SPTemplateFileType]::FormPage)
$editform = $files.add($editformurl, [Microsoft.SharePoint.SPTemplateFileType]::FormPage)
$newform = $files.add($newformurl, [Microsoft.SharePoint.SPTemplateFileType]::FormPage)
 
$wpm = $editform.GetLimitedWebPartManager([System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
$wpm2 = $dispform.GetLimitedWebPartManager([System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
$wpm3 = $newform.GetLimitedWebPartManager([System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
 
$lfw1 = new-object ([Microsoft.SharePoint.WebPartPages.ListFormwebpart])
$lfw2 = new-object ([Microsoft.SharePoint.WebPartPages.ListFormwebpart])
$lfw3 = new-object ([Microsoft.SharePoint.WebPartPages.ListFormwebpart])
 
$ilist1 = [Microsoft.SharePoint.WebPartPages.IListWebPart]($lfw1)
$ilist2 = [Microsoft.SharePoint.WebPartPages.IListWebPart]($lfw2)
$ilist3 = [Microsoft.SharePoint.WebPartPages.IListWebPart]($lfw3)
 
$ilist1.ListId = $list.id
$ilist1.PageType = [Microsoft.SharePoint.PAGETYPE]::PAGE_EDITFORM;
 
$ilist2.ListId = $list.id
$ilist2.PageType = [Microsoft.SharePoint.PAGETYPE]::PAGE_DISPLAYFORM;
 
$ilist3.ListId = $list.id
$ilist3.PageType = [Microsoft.SharePoint.PAGETYPE]::PAGE_NEWFORM;
 
$wpm.AddWebPart($lfw1, "Main", 1)
$wpm2.AddWebPart($lfw2, "Main", 1)
$wpm3.AddWebPart($lfw3, "Main", 1)
 
 
$list.DefaultDisplayFormUrl = $dispformurl
$list.DefaultEditFormUrl = $editformurl
$list.DefaultNewFormUrl = $newformurl
 
$list.update()

# # ===================

 

Error Code

None