Apr 25 2022 11:19 AM
Dear Microsoft Community
I have a working PowerShell Script for toggling a Microsoft Teams Auto Attendant target between CallQueue or a ExternalPstn. Developed since PowerShell Module Version 2.0.0 up to Version 3.0.0.
The main part of the Script for updating the $AutoAttendant.DefaultCallFlow.Menu.MenuOptions is the following
$AutoAttendant = Get-CsAutoAttendant | Where-object {$_.Identity -eq $($Identity)}
$First = $AutoAttendant.DefaultCallFlow.Menu.MenuOptions | Select-Object -First 1
$AutoAttendant.DefaultCallFlow.Menu.MenuOptions.Remove($First)
Switch ($Target)
{
"ApplicationEndpoint" {
$CallQueue = New-CsAutoAttendantCallableEntity -Identity $($ResourceAccount) -Type ApplicationEndpoint
$MenuOption = New-CsAutoAttendantMenuOption -Action TransferCallToTarget -CallTarget $($CallQueue) -DtmfRespons Automatic
($AutoAttendant.DefaultCallFlow.Menu.MenuOptions.Add($($MenuOption))) | Out-Null
}
"ExternalPstn" {
$PhoneNumber = New-CsAutoAttendantCallableEntity -Identity "tel:$($Global:CurrentPhoneNumber.Line)" -Type ExternalPstn
$MenuOption = New-CsAutoAttendantMenuOption -Action TransferCallToTarget -CallTarget $($PhoneNumber) -DtmfRespons Automatic
($AutoAttendant.DefaultCallFlow.Menu.MenuOptions.Add($($MenuOption))) | Out-Null
}
}
But since Microsoft Teams PowerShell Module Version 4.0.0 or current 4.2.0, i receive an error removing the first MenuOptions Entry at following script line $AutoAttendant.DefaultCallFlow.Menu.MenuOptions.Remove($First)
Exception calling "Remove" with "1" argument(s): "Collection was of a fixed size."
At line:1 char:1
+ $AutoAttendant.DefaultCallFlow.Menu.MenuOptions.Remove($First)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : NotSupportedException
is this a known Issues of the current PowerShell Module and what is the plan for a fix.
many thanks
Andy
Apr 26 2022 03:26 AM
Apr 26 2022 03:33 AM
Dear Andres
$First = $AutoAttendant.DefaultCallFlow.Menu.MenuOptions | Select-Object -First 1
$First shows
ApplicationEndPoint
Action : TransferCallToTarget
DtmfResponse : Automatic
VoiceResponses :
CallTarget : Type = ApplicationEndpoint
Id = af1dc44d-22e3-4f3c-8e46-877650172514
Prompt :
ExternalPstn
Action : TransferCallToTarget
DtmfResponse : Automatic
VoiceResponses :
CallTarget : Type = ExternalPstn
Id = tel:+41448041414
Prompt :
The Error happend with following Command
$AutoAttendant.DefaultCallFlow.Menu.MenuOptions.Remove($First)
with the working PS Module, the menOptions is now empty, so I can assign the new menuOption
Apr 26 2022 12:30 PM
Apr 27 2022 08:34 AM
Apr 27 2022 11:27 AM
Apr 27 2022 11:42 AM