Skip to content

Commit

Permalink
More updates for FilePlanProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
desmay committed Jun 27, 2019
1 parent 09da584 commit e2223e8
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ function Get-TargetResource
Write-Verbose -Message "Calling Test-SecurityAndComplianceConnection function:"
Test-SecurityAndComplianceConnection -GlobalAdminAccount $GlobalAdminAccount

#Testing only
Write-Verbose -Message "FilePlane $($FilePlan.FilePlanPropertyDepartment)"

$tagObjects = Get-ComplianceTag
$tagObjects = $tagObjects | Where-Object { $_.Name -eq $Name }

Expand Down Expand Up @@ -177,7 +180,7 @@ function Set-TargetResource
if ($FilePlanProperty)
{
Write-Verbose -Message "Converting fileplan to JSON"
$FilePlanPropertyJSON = ConvertTo-Json $FilePlanProperty
$FilePlanPropertyJSON = Get-SCFilePlanProperty $FilePlanProperty
$CreationParams["FilePlanProperty"] = $FilePlanPropertyJSON
}
$CreationParams.Remove("GlobalAdminAccount")
Expand All @@ -199,7 +202,7 @@ function Set-TargetResource
if ($FilePlanProperty)
{
Write-Verbose -Message "Converting fileplan to JSON"
$FilePlanPropertyJSON = ConvertTo-Json $FilePlanProperty
$FilePlanPropertyJSON = Get-SCFilePlanProperty $FilePlanProperty
$SetParams["FilePlanProperty"] = $FilePlanPropertyJSON
}
Set-ComplianceTag @SetParams -Identity $Name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
[ClassVersion("1.0.0")]
Class MSFT_FilePlanProperty
{
[Write, Description("The FilePlanProperty parameter specifies the file plan properties to include in the label. To view the file plan property names that you need to use in this parameter, run the following commands.")] String FilePlanProperty;
[Write, Description("File plan department. Can get list by running Get-FilePlanPropertyDepartment.")] String FilePlanPropertyDepartment;
[Write, Description("File plan Authority. Can get list by running Get-FilePlanPropertyAuthority.")] String FilePlanPropertyAuthority;
[Write, Description("File plan category. Can get a list by running Get-FilePlanPropertyCategory.")] String FilePlanPropertyCategory;
[Write, Description("File plan citation. Can get a list by running Get-FilePlanPropertyCitation.")] String FilePlanPropertyCitation;
[Write, Description("File plan reference id. Can get a list by running Get-FilePlanPropertyReferenceId.")] String FilePlanPropertyReferenceId;
[Write, Description("File plan subcategory. Can get a list by running Get-FilePlanPropertySubCategory.")] String FilePlanPropertySubCategory;
};
[ClassVersion("1.0.0.0"), FriendlyName("SCRetentionComplianceTag")]
class MSFT_SCRetentionComplianceTag : OMI_BaseResource
Expand All @@ -12,7 +17,8 @@ class MSFT_SCRetentionComplianceTag : OMI_BaseResource
[Write, Description("The EventType parameter specifies the retention rule that's associated with the label.")] String EventType;
[Write, Description("The IsRecordLabel parameter specifies whether the label is a record label.")] Boolean IsRecordLabel;
[Write, Description("The Notes parameter specifies an optional note. If you specify a value that contains spaces, enclose the value in quotation marks, for example: 'This is a user note'")] String Notes;
[Write, Description("Regulatory")] Boolean Regulatory;
[Write, Description("Regulatory description")] Boolean Regulatory;
[Write, Description("The FilePlanProperty parameter specifies the file plan properties to include in the label."),EmbeddedInstance("MSFT_FilePlanProperty")] String FilePlanProperty;
[Write, Description("The ReviewerEmail parameter specifies the email address of a reviewer for Delete and KeepAndDelete retention actions. You can specify multiple email addresses separated by commas.")] String ReviewerEmail;
[Write, Description("The RetentionDuration parameter specifies the hold duration for the retention rule. Valid values are: An integer - The hold duration in days, Unlimited - The content is held indefinitely.")] String RetentionDuration;
[Write, Description("The RetentionAction parameter specifies the action for the label. Valid values are: Delete, Keep or KeepAndDelete."), ValueMap{"Delete","Keep","KeepAndDelete"}, Values{"Delete","Keep","KeepAndDelete"}] String RetentionAction;
Expand Down
17 changes: 17 additions & 0 deletions Modules/Office365DSC/Modules/Office365DSCUtil.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1839,3 +1839,20 @@ function Get-SPOAdministrationUrl
Write-Verbose -Message "SharePoint Online admin URL is $global:AdminUrl"
return $global:AdminUrl
}
function Get-SCFilePlanProperty
{
[CmdletBinding()]
param(
[Parameter()]
$FilePlan
)

if ($null -eq $FilePlan)
{
return $null
}

Write-Verbose -Message "FilePlan Property: $($FilePlan.FilePlanPropertyDepartment)"

return $result
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
Comment = "This is a test Rule"
RetentionAction = "Keep"
RetentionDuration = "1025"
FilePlanProperty = [PSCustomObject]@{Settings=@(@{Key="FilePlanPropertyDepartment";Value="Legal"})}
FilePlanProperty = (New-CimInstance -ClassName MSFT_FilePlanProperty -Property @{
FilePlanPropertyDepartment = "Legal"
}-ClientOnly)
GlobalAdminAccount = $GlobalAdminAccount
RetentionType = "ModificationAgeInDays"
Ensure = "Present"
Expand Down Expand Up @@ -86,7 +88,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
Comment = "This is a test Rule"
RetentionAction = "Keep"
RetentionDuration = "1025"
FilePlanProperty = [PSCustomObject]@{Settings=@(@{Key="FilePlanPropertyDepartment";Value="Legal"})}
FilePlanProperty = (New-CimInstance -ClassName MSFT_FilePlanProperty -Property @{
FilePlanPropertyDepartment = "Legal"
}-ClientOnly)
GlobalAdminAccount = $GlobalAdminAccount
RetentionType = "ModificationAgeInDays"
Ensure = "Present"
Expand Down Expand Up @@ -117,20 +121,22 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
Name = "TestRule"
Comment = "This is a test Rule"
RetentionAction = "Keep"
FilePlanProperty = [PSCustomObject]@{Settings=@(@{Key="FilePlanPropertyDepartment";Value="Legal"})}
FilePlanProperty = (New-CimInstance -ClassName MSFT_FilePlanProperty -Property @{
FilePlanPropertyDepartment = "Legal"
}-ClientOnly)
RetentionDuration = "1025"
GlobalAdminAccount = $GlobalAdminAccount
RetentionType = "ModificationAgeInDays"
}

Mock -CommandName Get-ComplianceTag -MockWith {
return @{
Name = "TestRule"

}
}

It 'Should return false from the Test method' {
Test-TargetResource @testParams | Should Be $false
It 'Should return True from the Test method' {
Test-TargetResource @testParams | Should Be $True
}

It 'Should delete from the Set method' {
Expand Down
6 changes: 3 additions & 3 deletions Tests/Unit/Stubs/Office365.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -12105,7 +12105,7 @@ function Remove-ComplianceTag

[Parameter()]
[System.Boolean]
$ForceDeletion
$Confirm
)
}
function New-ComplianceTag
Expand All @@ -12121,7 +12121,7 @@ function New-ComplianceTag
$Comment,

[Parameter()]
[System.String]
[Microsoft.Management.Infrastructure.CimInstance]
$FilePlanProperty,

[Parameter()]
Expand Down Expand Up @@ -12173,7 +12173,7 @@ function Set-ComplianceTag
$Comment,

[Parameter()]
[System.String]
[Microsoft.Management.Infrastructure.CimInstance]
$FilePlanProperty,

[Parameter()]
Expand Down

0 comments on commit e2223e8

Please sign in to comment.