diff --git a/Content Types/Get/Get All Detailed Properties of All Content Types/ContentTypesWithoutPSObject.ps1 b/Content Types/Get/Get All Detailed Properties of All Content Types/ContentTypesWithoutPSObject.ps1 index a21b170e..d8eea6bc 100644 --- a/Content Types/Get/Get All Detailed Properties of All Content Types/ContentTypesWithoutPSObject.ps1 +++ b/Content Types/Get/Get All Detailed Properties of All Content Types/ContentTypesWithoutPSObject.ps1 @@ -1,74 +1,51 @@  -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 - Write-Host $ctx.Url -BackgroundColor White -ForegroundColor DarkGreen - foreach( $cc in $ctx.Web.ContentTypes) - { - - - $ctx.Load($cc) - $ctx.Load($cc.FieldLinks) - $ctx.Load($cc.Fields) - $ctx.Load($cc.WorkflowAssociations) - $ctx.ExecuteQuery() - $cc | Add-Member NoteProperty Web($url) - foreach($field in $cc.Fields) - { - $PropertyName="Field"+$field.ID - $cc | Add-Member NoteProperty $PropertyName($field.Title) - } - foreach($fieldlink in $cc.FieldLinks) - { - $PropertyName="Fieldlink"+$fieldlink.ID - $cc | Add-Member NoteProperty $PropertyName($fieldlink.Name) - } - foreach($workflow in $cc.WorkflowAssociations) - { - $PropertyName="Workflow"+$workflow.ID - $cc | Add-Member NoteProperty $PropertyName($workflow.Name) - } - Write-Output $cc - } - - - - - - - } - - - - - - - - - - - - - - + ) + + $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 + Write-Host $ctx.Url -BackgroundColor White -ForegroundColor DarkGreen + + foreach( $cc in $ctx.Web.ContentTypes){ + $ctx.Load($cc) + $ctx.Load($cc.FieldLinks) + $ctx.Load($cc.Fields) + $ctx.Load($cc.WorkflowAssociations) + $ctx.ExecuteQuery() + $cc | Add-Member NoteProperty Web($url) + + foreach($field in $cc.Fields){ + $PropertyName="Field"+$field.ID + $cc | Add-Member NoteProperty $PropertyName($field.Title) + } + + foreach($fieldlink in $cc.FieldLinks){ + $PropertyName="Fieldlink"+$fieldlink.ID + $cc | Add-Member NoteProperty $PropertyName($fieldlink.Name) + } + + foreach($workflow in $cc.WorkflowAssociations){ + $PropertyName="Workflow"+$workflow.ID + $cc | Add-Member NoteProperty $PropertyName($workflow.Name) + } + + Write-Output $cc + } +} # Paths to SDK. Please verify location on your computer. @@ -82,4 +59,4 @@ $AdminUrl="https://tenant.sharepoint.com/sites/teamsitewithlibraries" -Get-SPOContentType -Username $Username -AdminPassword $AdminPassword -Url $AdminUrl \ No newline at end of file +Get-SPOContentType -Username $Username -AdminPassword $AdminPassword -Url $AdminUrl