Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NikCharlebois committed Jan 26, 2023
1 parent 9e1b070 commit f909b89
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

# UNRELEASED

* PlannerTask
* Fixed issue where Attachments Uri weren't properly exiting single quotes.
FIXES [#2822](https://github.com/microsoft/Microsoft365DSC/issues/2822)
* SCProtectionAlert
* Support for certificate based auth
* Fix removal of alert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,7 @@ function Export-TargetResource
-Results $Result
if ($result.Attachments.Length -gt 0)
{
$result.Attachments = [Array](Convert-M365DSCPlannerTaskAssignmentToCIMArray `
-Attachments $result.Attachments)
$result.Attachments = Convert-M365DSCPlannerTaskAssignmentToCIMArray -Attachments $result.Attachments
}
else
{
Expand All @@ -766,8 +765,7 @@ function Export-TargetResource

if ($result.Checklist.Length -gt 0)
{
$result.Checklist = [Array](Convert-M365DSCPlannerTaskChecklistToCIMArray `
-Checklist $result.Checklist)
$result.Checklist = Convert-M365DSCPlannerTaskChecklistToCIMArray -Checklist $result.Checklist
}
else
{
Expand All @@ -790,14 +788,12 @@ function Export-TargetResource
if ($result.Attachments.Length -gt 0)
{
$currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock `
-ParameterName 'Attachments' `
-IsCIMArray $true
-ParameterName 'Attachments'
}
if ($result.Checklist.Length -gt 0)
{
$currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock `
-ParameterName 'Checklist' `
-IsCIMArray $true
-ParameterName 'Checklist'
}

$dscContent += $currentDSCBlock
Expand Down Expand Up @@ -887,17 +883,18 @@ function Convert-M365DSCPlannerTaskAssignmentToCIMArray
$Attachments
)

$result = @()
$stringContent = "@(`r`n"
foreach ($attachment in $Attachments)
{
$stringContent = "MSFT_PlannerTaskAttachment`r`n {`r`n"
$stringContent += " Uri = '$($attachment.Uri)'`r`n"
$stringContent += " Alias = '$($attachment.Alias.Replace("'", "''"))'`r`n"
$stringContent += " Type = '$($attachment.Type)'`r`n"
$StringContent += " }`r`n"
$result += $stringContent
$stringContent += " MSFT_PlannerTaskAttachment`r`n"
$stringContent += " {`r`n"
$stringContent += " Uri = '$($attachment.Uri.Replace("'", "''"))'`r`n"
$stringContent += " Alias = '$($attachment.Alias.Replace("'", "''"))'`r`n"
$stringContent += " Type = '$($attachment.Type)'`r`n"
$StringContent += " }`r`n"
}
return $result
$StringContent += ' )'
return $StringContent
}

function Convert-M365DSCPlannerTaskChecklistToCIMArray
Expand All @@ -910,16 +907,17 @@ function Convert-M365DSCPlannerTaskChecklistToCIMArray
$Checklist
)

$result = @()
$stringContent = "@(`r`n"
foreach ($checklistItem in $Checklist)
{
$stringContent = "MSFT_PlannerTaskChecklistItem`r`n {`r`n"
$stringContent += " Title = '$($checklistItem.Title.Replace("'", "''"))'`r`n"
$stringContent += " Completed = `$$($checklistItem.Completed.ToString())`r`n"
$StringContent += " }`r`n"
$result += $stringContent
$stringContent += " MSFT_PlannerTaskChecklistItem`r`n"
$stringCOntent += " {`r`n"
$stringContent += " Title = '$($checklistItem.Title.Replace("'", "''"))'`r`n"
$stringContent += " Completed = `$$($checklistItem.Completed.ToString())`r`n"
$StringContent += " }`r`n"
}
return $result
$StringContent += ' )'
return $StringContent
}

function Get-M365DSCPlannerPlansFromGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
EnterpriseIPRanges = @(
(New-CimInstance -ClassName MSFT_MicrosoftGraphwindowsInformationProtectionIPRangeCollection -Property @{
DisplayName = "FakeStringValue"
Ranges = (New-CimInstance -ClassName MSFT_MicrosoftGraphipRange -Property @{
Ranges = [CIMInstance[]]@(New-CimInstance -ClassName MSFT_MicrosoftGraphipRange -Property @{
CidrAddress = "FakeStringValue"
UpperAddress = "FakeStringValue"
LowerAddress = "FakeStringValue"
Expand Down

0 comments on commit f909b89

Please sign in to comment.