Skip to content

Commit 5fee4fe

Browse files
Merge pull request KelvinTegelaar#1414 from Zacgoose/Room-Mailboxes
Feat: Add advanced options for Room Mailboxes
2 parents 133193c + 5454d32 commit 5fee4fe

File tree

2 files changed

+70
-2
lines changed

2 files changed

+70
-2
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-EditRoomMailbox.ps1

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,54 @@ Function Invoke-EditRoomMailbox {
5353
}
5454
}
5555

56+
57+
# Then update the calendar properties
58+
$UpdateCalendarParams = @{
59+
Identity = $MailboxObject.roomId
60+
}
61+
62+
$CalendarProperties = @(
63+
'AllowConflicts', 'AllowRecurringMeetings', 'BookingWindowInDays',
64+
'MaximumDurationInMinutes', 'ProcessExternalMeetingMessages', 'EnforceCapacity',
65+
'ForwardRequestsToDelegates', 'ScheduleOnlyDuringWorkHours ', 'AutomateProcessing'
66+
)
67+
68+
foreach ($prop in $CalendarProperties) {
69+
if (![string]::IsNullOrWhiteSpace($MailboxObject.$prop)) {
70+
$UpdateCalendarParams[$prop] = $MailboxObject.$prop
71+
}
72+
}
73+
74+
# Then update the calendar configuration
75+
$UpdateCalendarConfigParams = @{
76+
Identity = $MailboxObject.roomId
77+
}
78+
79+
$CalendarConfiguration = @(
80+
'WorkDays', 'WorkHoursStartTime', 'WorkHoursEndTime', 'WorkingHoursTimeZone'
81+
)
82+
83+
foreach ($prop in $CalendarConfiguration) {
84+
if (![string]::IsNullOrWhiteSpace($MailboxObject.$prop)) {
85+
$UpdateCalendarConfigParams[$prop] = $MailboxObject.$prop
86+
}
87+
}
88+
5689
try {
5790
# Update mailbox properties
5891
$null = New-ExoRequest -tenantid $Tenant -cmdlet 'Set-Mailbox' -cmdParams $UpdateMailboxParams
5992

6093
# Update place properties
6194
$null = New-ExoRequest -tenantid $Tenant -cmdlet 'Set-Place' -cmdParams $UpdatePlaceParams
62-
$Results.Add("Successfully updated room: $($MailboxObject.DisplayName)")
95+
$Results.Add("Successfully updated room: $($MailboxObject.DisplayName) (Place Properties)")
96+
97+
# Update calendar properties
98+
$null = New-ExoRequest -tenantid $Tenant -cmdlet 'Set-CalendarProcessing' -cmdParams $UpdateCalendarParams
99+
$Results.Add("Successfully updated room: $($MailboxObject.DisplayName) (Calendar Properties)")
100+
101+
# Update calendar configuration properties
102+
$null = New-ExoRequest -tenantid $Tenant -cmdlet 'Set-MailboxCalendarConfiguration' -cmdParams $UpdateCalendarConfigParams
103+
$Results.Add("Successfully updated room: $($MailboxObject.DisplayName) (Calendar Configuration)")
63104

64105
Write-LogMessage -headers $Request.Headers -API $APIName -tenant $Tenant -message "Updated room $($MailboxObject.DisplayName)" -Sev 'Info'
65106
$StatusCode = [HttpStatusCode]::OK

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-ListRooms.ps1

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,17 @@ Function Invoke-ListRooms {
3232
Identity = $RoomId
3333
} | Select-Object -ExcludeProperty *@odata.type*
3434

35-
if ($RoomMailbox -and $PlaceDetails) {
35+
# Get calendar properties
36+
$CalendarProperties = New-ExoRequest -tenantid $TenantFilter -cmdlet 'Get-CalendarProcessing' -cmdParams @{
37+
Identity = $RoomId
38+
} | Select-Object -ExcludeProperty *@odata.type*
39+
40+
# Get calendar properties
41+
$CalendarConfigurationProperties = New-ExoRequest -tenantid $TenantFilter -cmdlet 'Get-MailboxCalendarConfiguration' -cmdParams @{
42+
Identity = $RoomId
43+
} | Select-Object -ExcludeProperty *@odata.type*
44+
45+
if ($RoomMailbox -and $PlaceDetails -and $CalendarProperties -and $CalendarConfigurationProperties) {
3646
$GraphRequest = @(
3747
[PSCustomObject]@{
3848
# Core Mailbox Properties
@@ -70,6 +80,23 @@ Function Invoke-ListRooms {
7080
phone = if ([string]::IsNullOrWhiteSpace($PlaceDetails.Phone)) { $null } else { $PlaceDetails.Phone }
7181
tags = $PlaceDetails.Tags
7282
spaceType = $PlaceDetails.SpaceType
83+
84+
# Calendar Properties
85+
AllowConflicts = $CalendarProperties.AllowConflicts
86+
AllowRecurringMeetings = $CalendarProperties.AllowRecurringMeetings
87+
BookingWindowInDays = $CalendarProperties.BookingWindowInDays
88+
MaximumDurationInMinutes = $CalendarProperties.MaximumDurationInMinutes
89+
ProcessExternalMeetingMessages= $CalendarProperties.ProcessExternalMeetingMessages
90+
EnforceCapacity = $CalendarProperties.EnforceCapacity
91+
ForwardRequestsToDelegates = $CalendarProperties.ForwardRequestsToDelegates
92+
ScheduleOnlyDuringWorkHours = $CalendarProperties.ScheduleOnlyDuringWorkHours
93+
AutomateProcessing = $CalendarProperties.AutomateProcessing
94+
95+
# Calendar Configuration Properties
96+
WorkDays = if ([string]::IsNullOrWhiteSpace($CalendarConfigurationProperties.WorkDays)) { $null } else { $CalendarConfigurationProperties.WorkDays }
97+
WorkHoursStartTime = if ([string]::IsNullOrWhiteSpace($CalendarConfigurationProperties.WorkHoursStartTime)) { $null } else { $CalendarConfigurationProperties.WorkHoursStartTime }
98+
WorkHoursEndTime = if ([string]::IsNullOrWhiteSpace($CalendarConfigurationProperties.WorkHoursEndTime)) { $null } else { $CalendarConfigurationProperties.WorkHoursEndTime }
99+
WorkingHoursTimeZone = $CalendarConfigurationProperties.WorkingHoursTimeZone
73100
}
74101
)
75102
}

0 commit comments

Comments
 (0)