diff --git a/Content Types/Display Forms/Unable to view items- modify the DisplayFormUrl back to default one/ModifyDisplayFormUrl-BackToDefault.ps1 b/Content Types/Display Forms/Unable to view items- modify the DisplayFormUrl back to default one/ModifyDisplayFormUrl-BackToDefault.ps1 index 9c4b7f01..5c5027ac 100644 --- a/Content Types/Display Forms/Unable to view items- modify the DisplayFormUrl back to default one/ModifyDisplayFormUrl-BackToDefault.ps1 +++ b/Content Types/Display Forms/Unable to view items- modify the DisplayFormUrl back to default one/ModifyDisplayFormUrl-BackToDefault.ps1 @@ -1,53 +1,36 @@  -function Set-SPOContentType -{ - - param ( - [Parameter(Mandatory=$true,Position=1)] +function Set-SPOContentType{ + param ( + [Parameter(Mandatory=$true,Position=1)] [string]$Username, [Parameter(Mandatory=$true,Position=2)] $AdminPassword, - [Parameter(Mandatory=$true,Position=3)] + [Parameter(Mandatory=$true,Position=3)] [string]$Url - ) - - $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url) - $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword) - $ctx.Load($ctx.Web.Lists) - $ctx.ExecuteQuery() - - - - foreach($ll in $ctx.Web.Lists) - { - Write-Host $ll.Title -ForegroundColor Green - $ctx.Load($ll.ContentTypes) - $ctx.ExecuteQuery() - foreach($cc in $ll.ContentTypes) - { - - if($cc.Name -eq "Item") - { - $cc.DisplayFormUrl="" - - $cc.Update($false) - $ctx.ExecuteQuery() - } - - - - - - } - } - - - - $ctx.Dispose() - - - } + ) + + $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url) + $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword) + $ctx.Load($ctx.Web.Lists) + $ctx.ExecuteQuery() + + foreach($ll in $ctx.Web.Lists){ + Write-Host $ll.Title -ForegroundColor Green + $ctx.Load($ll.ContentTypes) + $ctx.ExecuteQuery() + + foreach($cc in $ll.ContentTypes){ + if($cc.Name -eq "Item"){ + $cc.DisplayFormUrl="" + $cc.Update($false) + $ctx.ExecuteQuery() + } + } + } + + $ctx.Dispose() +}