From b5abc6c32655e29f5e43c095cb64ef147c205d4c Mon Sep 17 00:00:00 2001 From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com> Date: Fri, 31 Jan 2020 22:14:16 +0100 Subject: [PATCH 1/2] Update GetSingleContentType.ps1 --- .../GetSingleContentType.ps1 | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/Content Types/Get/Get Single Content Type - Array Method/GetSingleContentType.ps1 b/Content Types/Get/Get Single Content Type - Array Method/GetSingleContentType.ps1 index 583f75bd..c99d39b6 100644 --- a/Content Types/Get/Get Single Content Type - Array Method/GetSingleContentType.ps1 +++ b/Content Types/Get/Get Single Content Type - Array Method/GetSingleContentType.ps1 @@ -1,26 +1,23 @@ -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.ContentTypes) - $ctx.ExecuteQuery() - Write-Host $ctx.Web.ContentTypes[0].Name - - } + ) + + $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.ContentTypes) + $ctx.ExecuteQuery() + Write-Host $ctx.Web.ContentTypes[0].Name +} From b41501441c02b1fa654af8f5dd534e722c7e8edc Mon Sep 17 00:00:00 2001 From: PowershellScripts <42035526+PowershellScripts@users.noreply.github.com> Date: Wed, 5 Feb 2020 22:38:09 +0200 Subject: [PATCH 2/2] Update GetSingleContentType.ps1 --- .../GetSingleContentType.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/Content Types/Get/Get Single Content Type - Array Method/GetSingleContentType.ps1 b/Content Types/Get/Get Single Content Type - Array Method/GetSingleContentType.ps1 index c99d39b6..83a4b5e0 100644 --- a/Content Types/Get/Get Single Content Type - Array Method/GetSingleContentType.ps1 +++ b/Content Types/Get/Get Single Content Type - Array Method/GetSingleContentType.ps1 @@ -13,7 +13,6 @@ function Get-SPOContentType{ $ctx.ExecuteQuery() $ctx.Load($ctx.Web) - $ctx.Load($ctx.Web.ContentTypes) $ctx.ExecuteQuery() Write-Host $ctx.Web.ContentTypes[0].Name