SharePoint Online: Get Default List Form (New/Edit/Display) URLs using PowerShell

Requirement: Get the default list form URLs in SharePoint Online.

How to Get the List Form URLs in a SharePoint Online List?

  • Just open the SharePoint Online site in SharePoint Designer,
  • Navigate to the Lists >> Open the Target List >> and You’ll find the default list of forms under the “Forms” section.sharepoint online modern list new item form url

CSOM PowerShell script to get SharePoint Online List form URLs

Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
 
#Set Parameters
$SiteURL= "https://Crescent.sharepoint.com/sites/marketing"
$ListName="Announcements"

#Setup Credentials to connect
$Cred = Get-Credential
     
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)
 
#Get the List
$List = $Ctx.Web.Lists.GetByTitle($ListName)
     
#Get List Properties
[string[]]$Properties = @("DefaultNewFormUrl","DefaultDisplayFormUrl","DefaultEditFormUrl")
$List.Retrieve($Properties)
$Ctx.Load($List)
$Ctx.ExecuteQuery()    

#Get sharepoint online list form urls
$List.DefaultNewFormUrl
$List.DefaultEditFormUrl
$List.DefaultDisplayFormUrl

PnP PowerShell Script to Get List Forms in SharePoint Online

PnP PowerShell makes things even simpler!

#Set Parameters
$SiteURL= "https://crescent.sharepoint.com/sites/marketing"
$ListName="Announcements"

#Connect to PnP
Connect-PnPOnline -Url $SiteURL -Interactive

#Get List Form URLs
$List = Get-PnPList -Identity $ListName -Includes DefaultDisplayFormUrl, DefaultEditFormUrl, DefaultNewFormUrl
$List.DefaultDisplayFormUrl
$List.DefaultEditFormUrl
$List.DefaultNewFormUrl

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. Passionate about sharing the deep technical knowledge and experience to help others, through the real-world articles!

One thought on “SharePoint Online: Get Default List Form (New/Edit/Display) URLs using PowerShell

  • How can we get URLs of All the forms of list and libraries, default as well as custom forms created in Sharepoint Designer?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *