This commit is contained in:
Jonatan Rek
2025-10-14 18:44:09 +02:00
parent 1a7ba16c85
commit d5ab85739d

View File

@@ -192,9 +192,6 @@ try {
continue continue
} }
#Inicializace dne
$ds_shift_inplace = $false
#Množina emailů pro tento den v týdnu co mají mít home office #Množina emailů pro tento den v týdnu co mají mít home office
$ho_emails = $schedule.($dayDate.DayOfWeek.ToString().ToLower()).'ho' $ho_emails = $schedule.($dayDate.DayOfWeek.ToString().ToLower()).'ho'
@@ -229,7 +226,7 @@ try {
foreach ($email in $allemails) { foreach ($email in $allemails) {
$userId = $(Get-MgUser -Filter "UserPrincipalName eq '$email' or proxyAddresses/any(c:c eq 'smtp:$email')").Id $userId = $(Get-MgUser -Filter "UserPrincipalName eq '$email' or proxyAddresses/any(c:c eq 'smtp:$email')").Id
if ($userId -in $shifts_today.UserId){ if ($userId -in $shifts_today.UserId) {
Write-Debug ("{0} has Manual Shift" -f $email) Write-Debug ("{0} has Manual Shift" -f $email)
continue; continue;
} }
@@ -273,17 +270,17 @@ try {
} }
} }
$params = @{ $params = @{
notifyTeam = $false notifyTeam = $false
startDateTime = [System.DateTime]::Parse($startSpanDate.ToString("yyyy-MM-dd'T'HH:mm:ssZ")) startDateTime = [System.DateTime]::Parse($startSpanDate.ToString("yyyy-MM-dd'T'HH:mm:ssZ"))
endDateTime = [System.DateTime]::Parse($endSpanDate.ToString("yyyy-MM-dd'T'HH:mm:ssZ")) endDateTime = [System.DateTime]::Parse($endSpanDate.ToString("yyyy-MM-dd'T'HH:mm:ssZ"))
}
Invoke-MgShareTeamSchedule -TeamId $team.Id -BodyParameter $params -Headers @{ "MS-APP-ACTS-AS" = $userIdAdmin }
("SHARING: {0}" -f $scheduleGroupName) | Add-Content -Path $logPath
}
catch {
$_
break;
} }
Invoke-MgShareTeamSchedule -TeamId $team.Id -BodyParameter $params -Headers @{ "MS-APP-ACTS-AS" = $userIdAdmin }
("SHARING: {0}" -f $scheduleGroupName) | Add-Content -Path $logPath
}
catch {
$_
break;
}