Skip to content

Commit

Permalink
Merge pull request #4085 from malauter/Fix-4056
Browse files Browse the repository at this point in the history
EXOMailboxCalendarFolder: Add support for non-English calendar names
  • Loading branch information
NikCharlebois authored Dec 29, 2023
2 parents b4decea + 890c447 commit bb8260c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change log for Microsoft365DSC

# UNRELEASED
* EXOMailboxCalendarFolder
* Add support for non-English calendar folder names during export
FIXES [#4056](https://github.com/microsoft/Microsoft365DSC/issues/4056)

# 1.23.1220.1

* AADEntitlementManagementAccessPackage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,9 @@ function Export-TargetResource
$i = 1
foreach ($mailbox in $mailboxes)
{
$folderPath = $mailbox.UserPrincipalName + ':\Calendar'
# Name of calendar folder depends on the language of the mailbox
$calendarFolderName = (Get-MailboxFolderStatistics -Identity $($mailbox.UserPrincipalName) -FolderScope Calendar | Where-Object {$_.FolderType -eq 'Calendar'}).Name
$folderPath = $mailbox.UserPrincipalName + ':\' + $calendarFolderName
Write-Host " |---[$i/$($mailboxes.Count)] $($folderPath)" -NoNewline
$Params = @{
Identity = $folderPath
Expand Down Expand Up @@ -452,7 +454,6 @@ function Export-TargetResource
$i++
}


return $dscContent
}
catch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
Credential = $Credential
}

Mock -CommandName Get-MailboxFolderStatistics -MockWith {
return @{
FolderType = "Calendar";
Name = "Calendar";
}
}

Mock -CommandName Get-MailboxCalendarFolder -MockWith {
return @{
DetailLevel = "AvailabilityOnly";
Expand All @@ -171,7 +178,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
}
}


It 'Should Reverse Engineer resource from the Export method' {
$result = Export-TargetResource @testParams
$result | Should -Not -BeNullOrEmpty
Expand Down
13 changes: 13 additions & 0 deletions Tests/Unit/Stubs/Microsoft365.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,19 @@ function Get-MailboxCalendarFolder
$Identity
)
}
function Get-MailboxFolderStatistics
{
[CmdletBinding()]
param(
[Parameter()]
[System.Object]
$Identity,

[Parameter()]
[System.String]
$FolderScope
)
}
function Get-MailboxPermission
{
[CmdletBinding()]
Expand Down

0 comments on commit bb8260c

Please sign in to comment.