From cd521ba49399c3e7e04846e41f9d2d3ee127c9d2 Mon Sep 17 00:00:00 2001 From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com> Date: Thu, 30 Jan 2020 19:23:44 +0100 Subject: [PATCH] Update CompareAvVSCT.ps1 --- .../CompareAvVSCT.ps1 | 92 ++++++++----------- 1 file changed, 36 insertions(+), 56 deletions(-) diff --git a/Content Types/Get/Compare Web.AvailableContentTypes vs Web.ContentTypes/CompareAvVSCT.ps1 b/Content Types/Get/Compare Web.AvailableContentTypes vs Web.ContentTypes/CompareAvVSCT.ps1 index e516ffa6..17c036f1 100644 --- a/Content Types/Get/Compare Web.AvailableContentTypes vs Web.ContentTypes/CompareAvVSCT.ps1 +++ b/Content Types/Get/Compare Web.AvailableContentTypes vs Web.ContentTypes/CompareAvVSCT.ps1 @@ -1,64 +1,44 @@  -function Get-SPOContentType -{ - - param ( - [Parameter(Mandatory=$true,Position=1)] +function Get-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.ExecuteQuery() - - $ctx.Load($ctx.Web) - $ctx.Load($ctx.Web.AvailableContentTypes) - $ctx.ExecuteQuery() - Write-Host -# Write-Host $ctx.Url -BackgroundColor White -ForegroundColor DarkGreen - $i=0 - foreach( $cc in $ctx.Web.AvailableContentTypes) - { - - $i++ - - } - Write-Host "Available content types " $i - - $ctx.Load($ctx.Web.ContentTypes) - $ctx.ExecuteQuery() - Write-Host - # Write-Host $ctx.Url -BackgroundColor White -ForegroundColor DarkGreen - $i=0 - foreach( $cc in $ctx.Web.ContentTypes) - { - - $i++ - - } - Write-Host "Content types in this site " $i - - - - } - - - - - - - - - - - - - + ) + + $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url) + $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword) + $ctx.ExecuteQuery() + + $ctx.Load($ctx.Web) + $ctx.Load($ctx.Web.AvailableContentTypes) + $ctx.ExecuteQuery() + Write-Host + # Write-Host $ctx.Url -BackgroundColor White -ForegroundColor DarkGreen + $i=0 + + foreach( $cc in $ctx.Web.AvailableContentTypes){ + $i++ + } + + Write-Host "Available content types " $i + + $ctx.Load($ctx.Web.ContentTypes) + $ctx.ExecuteQuery() + Write-Host + # Write-Host $ctx.Url -BackgroundColor White -ForegroundColor DarkGreen + $i=0 + + foreach( $cc in $ctx.Web.ContentTypes){ + $i++ + } + + Write-Host "Content types in this site " $i +} @@ -73,4 +53,4 @@ $AdminUrl="https://tenant.sharepoint.com/sites/teamsitewithlibraries/subsite" -Get-SPOContentType -Username $Username -AdminPassword $AdminPassword -Url $AdminUrl \ No newline at end of file +Get-SPOContentType -Username $Username -AdminPassword $AdminPassword -Url $AdminUrl