You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Only add the internal and external message if they are not empty/null. Done to be able to set the OOO to disabled, while keeping the existing messages intact.
40
+
# This works because the frontend always sends some HTML even if the fields are empty.
41
+
if (-not [string]::IsNullOrWhiteSpace($InternalMessage)) {
42
+
$SplatParams.InternalMessage=$InternalMessage
43
+
}
44
+
if (-not [string]::IsNullOrWhiteSpace($ExternalMessage)) {
45
+
$SplatParams.ExternalMessage=$ExternalMessage
33
46
}
34
-
} catch {
35
-
"Could not add out of office message for $($Username). Error: $($_.Exception.Message)"
36
47
}
37
48
38
-
$Body= [PSCustomObject]@{'Results'=$($Results) }
49
+
50
+
# If the state is scheduled, add the start and end times to the splat params
51
+
if ($State-eq'Scheduled') {
52
+
# If starttime and endtime are a number, they are unix timestamps and need to be converted to datetime, otherwise just use them.
Copy file name to clipboardExpand all lines: Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-CIPPOffboardingJob.ps1
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,11 @@ function Invoke-CIPPOffboardingJob {
Write-LogMessage-headers $Headers-API $APIName-message "Scheduled Out-of-office for $($userid) between $StartTime and $EndTime"-Sev 'Info'-tenant $TenantFilter
29
-
return"Scheduled Out-of-office for $($userid) between $($StartTime.toString()) and $($EndTime.toString())"
32
+
33
+
if ($State-eq'Scheduled') {
34
+
# If starttime or endtime are not provided, default to enabling OOO for 7 days
0 commit comments