|
| 1 | +function Get-AllContentClassesInEditing |
| 2 | +{ |
| 3 | + <# |
| 4 | + .SYNOPSIS |
| 5 | + Retrieves all content classes which are currently being edited |
| 6 | + .DESCRIPTION |
| 7 | + With this CMDlet you can get a report about which content classes are being edited and since when |
| 8 | + #> |
| 9 | + [CmdletBinding(DefaultParameterSetName = 'byMSSession')] |
| 10 | + param( |
| 11 | + [Parameter( |
| 12 | + Position = 0, |
| 13 | + Mandatory = $false, |
| 14 | + ParameterSetName = 'byMSSession' |
| 15 | + )] |
| 16 | + [string] $ContentClassFolderGUID |
| 17 | + ) |
| 18 | + begin { |
| 19 | + Write-Debug -Message ("[ Enter => function {0} ]" -f $MyInvocation.MyCommand); |
| 20 | + |
| 21 | + Register-MSConfigStore; |
| 22 | + |
| 23 | + Set-MSConfigDebugMode -Value ($false); # $true oder $false |
| 24 | + |
| 25 | + Register-MSSession -UseDefaults ($true); |
| 26 | + Select-MSSession -UseDefaults ($true); |
| 27 | + Enter-MSSession -UseDefaults ($true); |
| 28 | + |
| 29 | + Enter-MSProject -ProjectGUID (Get-MSSessionProperty -Name ("ProjectGUID")) | Out-Null; |
| 30 | + } |
| 31 | + process { |
| 32 | + Write-Debug -Message ("[ Process => function {0} ]" -f $MyInvocation.MyCommand); |
| 33 | + |
| 34 | + $AllContentClassesOfFolder = (Get-MSContentClasses -ContentClassFolderGUID ($ContentClassFolder.guid)).SelectNodes("IODATA/TEMPLATES/TEMPLATE"); |
| 35 | + |
| 36 | + $Result = @() |
| 37 | + foreach ($ContentClass in $AllContentClassesOfFolder) { |
| 38 | + $ContentClassProperties = Get-MSContentClassAllProperties -ContentClassGUID $ContentClass.guid |
| 39 | + $TemplateVariants = $ContentClassProperties.SelectNodes("IODATA/TEMPLATE/TEMPLATEVARIANTS") |
| 40 | + foreach ($TemplateVariant in $TemplateVariants) |
| 41 | + { |
| 42 | + if ($TemplateVariant.lock -eq "1") |
| 43 | + { |
| 44 | + foreach ($TemplateVariantAtom in $TemplateVariants.SelectNodes("TEMPLATEVARIANT")) |
| 45 | + { |
| 46 | + if ($TemplateVariantAtom.draft -eq "1") |
| 47 | + { |
| 48 | + # Using ordered so we can assure this is the correct order of attributes |
| 49 | + $ResultObject = [pscustomobject][ordered]@{ |
| 50 | + ContentClassName = $ContentClass.name |
| 51 | + TemplateVariant = $TemplateVariantAtom.name |
| 52 | + Guid = $TemplateVariantAtom.guid |
| 53 | + Lockdate = $TemplateVariantAtom.changeddate | ConvertFrom-OADate |
| 54 | + Lockuser = $TemplateVariantAtom.changedusername |
| 55 | + } |
| 56 | + |
| 57 | + $Result += $ResultObject |
| 58 | + } |
| 59 | + } |
| 60 | + } |
| 61 | + } |
| 62 | + } |
| 63 | + |
| 64 | + return $Result |
| 65 | + } |
| 66 | + end { |
| 67 | + Write-Debug -Message ("[ Leave => function {0} ]" -f $MyInvocation.MyCommand); |
| 68 | + |
| 69 | + Exit-MSSession -UseDefaults ($true); |
| 70 | + Unregister-MSSession -UseDefaults ($true); |
| 71 | + |
| 72 | + Unregister-MSConfigStore; |
| 73 | + } |
| 74 | +} |
0 commit comments